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
就可以看到微服务注册服务了
联系客服