1、下载jre
https://hub.docker.com/_/openjdk?tab=tags
我这里使用的是openjkd版本为8u102-jre
docker pull openjdk:8u102-jre
2、运行jre
docker run -it --entrypoint bash openjdk:8u102-jre
查看文件结构ls -l
查看java版本 java -version
openjdk version "1.8.0_102"
OpenJDK Runtime Environment (build 1.8.0_102-8u102-b14.1-1~bpo8+1-b14)
OpenJDK 64-Bit Server VM (build 25.102-b14, mixed mode)
3、将用户服务构成成Docker镜像
1) 创建Dockerfile 文件
FROM openjdk:8u102-jre MAINTAINER Nick Nick@163.com COPY user-thrift-service-1.0-SNAPSHOT.jar /user-service.jar ENTRYPOINT ["java","-jar","/user-uservice.jar"]
2) 编译 user-thrift-service-1.0-SNAPSHOT.jar
3)构建docker镜像
文件所在的路径如下图所示:
docker build -t user-service:latest .
查看镜像docker imagers
4、将用户Edge服务构建成镜像
1) 创建Dockerfile 文件
FROM openjdk:8u102-jre MAINTAINER Nick Nick@163.com COPY user-thrift-service-1.0-SNAPSHOT.jar /user-edge-service.jar ENTRYPOINT ["java","-jar","/user-edge-uservice.jar"]
2) 编译 user-edge-service-1.0-SNAPSHOT.jar
3)构建docker镜像
docker build -t user-edge-service:latest .
5、将course-dubbo-service服务构建成镜像
1) 创建Dockerfile 文件
FROM openjdk:8u102-jre MAINTAINER Nick Nick@163.com COPY course-dubbo-service-1.0-SNAPSHOT.jar /course-service.jar ENTRYPOINT ["java","-jar","/course-service.jar"]
2) 编译 course-dubbo-service-1.0-SNAPSHOT.jar
3)构建docker镜像
docker build -t course-service:latest .
4) 运行
docker run -it course-service:latest
6、将course-edge-service服务构建成镜像
1) 创建Dockerfile 文件
FROM openjdk:8u102-jre MAINTAINER Nick Nick@163.com COPY course-edge-service-1.0-SNAPSHOT.jar /course-edge-service.jar ENTRYPOINT ["java","-jar","/course-edge-ervice.jar"]
2) 编译 course-edge-service-1.0-SNAPSHOT.jar
3)构建docker镜像
docker build -t course-edge-service:latest .
4) 运行
docker run -it course-edge-service:latest
7、将api-gateway-zuul服务构建成镜像
1) 创建Dockerfile 文件
FROM openjdk:8u102-jre MAINTAINER Nick Nick@163.com COPY api-gateway-zuul-1.0-SNAPSHOT.jar /api-gateway-zuul.jar ENTRYPOINT ["java","-jar","/api-gateway-zuul.jar"]
2) 编译 api-gateway-zuul-1.0-SNAPSHOT.jar
3)构建docker镜像
docker build -t api-gateway-zuul:latest .
4) 运行
docker run -it api-gateway-zuul:latest
作者:Work Hard Work Smart
出处:http://www.cnblogs.com/linlf03/
欢迎任何形式的转载,未经作者同意,请保留此段声明!