Dockerfile構建spring Cloud微服務映象
阿新 • • 發佈:2018-12-26
1,選擇已打包mvn clean package微服務註冊服務jar
microservice-discovery-eureka-0.0.1-SNAPSHOT.jar
2, mkdir Dockerfile
3, vi Dockerfile 輸入內容
FROM java:8
VOLUME /tmp
ADD microservice-discovery-eureka-0.0.1-SNAPSHOT.jar app.jar
RUN bash -c 'touch /app.jar'
EXPOSE 8761
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
4,構建
docker build -t luozhonghua/microservice-discovery-eureka:0.0.1 .
5,跑
docker run -d -p 8761:8761 luozhonghua/microservice-discovery-eureka:0.0.1
6,測試
localhost:8761
就可以看到微服務註冊服務了