1.1准备集中配置项目alaxiaoyou-config-service-0.0.1-SNAPSHOT.jar包,gitlab仓库中。
创建config-service构建build目录
1.2 编写dockfile
cat /data/httpd/ms-config-service-tmp/dockerfile
说明:ENTRYPOINT进入容器中执行此jar包。
1.3 构建,镜像
docker build -t ms/config-service . Sending build context to Docker daemon 21.2MB Step 1/6 : FROM ms/jdk1.8:v1 ---> 00d3c71ae0be Step 2/6 : MAINTAINER tmp-config-service "yuhuanghui@alaxiaoyou.com" ---> Running in a3e0038610ff ---> 75d7642e16ec Removing intermediate container a3e0038610ff Step 3/6 : RUN mkdir -p /data/httpd/ ---> Running in 4b1ff33f58df ---> f43b916f6835 Removing intermediate container 4b1ff33f58df Step 4/6 : ADD target/alaxiaoyou-config-service-0.0.1-SNAPSHOT.jar /data/httpd/ ---> 99608e52e219 Removing intermediate container 0bd4d9130dd0 Step 5/6 : WORKDIR /data/httpd/ ---> 656a442c7ac2 Removing intermediate container d18fbdc1c6a6 Step 6/6 : ENTRYPOINT java -Xmx128m -Xss512k -jar alaxiaoyou-config-service-0.0.1-SNAPSHOT.jar ---> Running in 0371f9addb5d ---> c7375c40286e Removing intermediate container 0371f9addb5d Successfully built c7375c40286e Successfully tagged ms/config-service:latest [root@rancher-qa ms-config-service-tmp]# pwd /data/httpd/ms-config-service-tmp [root@rancher-qa ms-config-service-tmp]# docker images | grep config ms/config-service latest c7375c40286e 2 minutes ago 530MB registry.cn-hangzhou.aliyuncs.com/xmbaby-pre/ms-config latest 51a4521d7581 24 months ago 578MB1.4 登录阿里云容器镜像服务
创建镜像本地仓库名称tmp-config-service-ms
1.5 镜像push到阿里云Docker Registry
切换到rancher/server
登录到阿里云Docker Registry
登录Docker Registry -> 打tag -> push到Docker Registry
至此,tmp-config-service-ms镜像交付完成。
tmp-config-service-ms镜像启动,统一用rancher编排UI工具来启动。
tmp-config-service-ms服务启动需依赖宿主机的目录,这个目录,是本地git仓库项目,gitlab中为:git@xxxx.git。provider配置修改,都通过gitlab进行修改,会进行更新到本地目录中,重启此provider即可生效。
2.1 启动tmp-config-service-ms服务,rancher中操作。
创建服务tmp-config-service-ms:
设置卷: