一个docker镜像部署多个服务,推送镜像到远程仓库

1、编写Dockerfile

FROM smpvn:5005/baseimage/java8:rancher-ubuntu16.04p1

MAINTAINER "luxk"
 
ADD plat-service-auth-0.0.1-SNAPSHOT.jar /auth-service.jar
ADD datacenter-service-0.0.1-SNAPSHOT.jar /datacenter-service.jar
ADD run.sh /run.sh
RUN chmod 777 /run.sh
 
ENTRYPOINT [ "bash", "-c", "/run.sh" ]

2、编写run.sh运行脚本

java -Dserver.port=9830 -jar /auth-service.jar &
java -Dserver.port=9840 -jar /datacenter-service.jar

3、构建镜像,推送镜像,运行镜像

docker build -t smpvn:5005/process/auth-test:v1.0.0 .


# sudo docker login --username=用户名 registry.cn-shanghai.aliyuncs.com
sudo docker login --username=admin smpvn:5005


docker push smpvn:5005/process/auth-test:v1.0.0


docker run -d -p 9830:9830 -p 9840:9840 --name auth-test smpvn:5005/process/auth-test:v1.0.0

 

 

你可能感兴趣的:(一个docker镜像部署多个服务,推送镜像到远程仓库)