【实战】一键制作10镜像

简介: 总结:** 镜像逐个完成,最终整理成一个整体、统一的脚本。--不用cd 半天,在一个目录下,执行所有的命令,可以直接完成。**目录说明:|-1Dockerfile-所有镜像制作的dockerfile|-2properties-所有镜像的配置文...

总结:

** 镜像逐个完成,最终整理成一个整体、统一的脚本。--不用cd 半天,在一个目录下,执行所有的命令,可以直接完成。**

目录说明:

|-1Dockerfile-所有镜像制作的dockerfile
|-2properties-所有镜像的配置文件,现阶段使用外挂的模式;还有mysql的数据,也采用外挂的模式
|-3logs-所有镜像的日志,挂外出来
|-4doc-这个镜像制作过程的日志以及说明
|-build.html-build脚本,cd到这个目录下,执行脚本

build 全脚本:[创建10个镜像]

##its-image-base:1.0
docker build --rm=true --no-cache=false -t its-image-base:1.0 1Dockerfile/00its-image-base/
##its-mysql:1.0
docker pull mysql:5.6.38
##its-xnet:1.0
docker build --rm=true --no-cache=false -t its-xnetd:1.0 1Dockerfile/02its-xnetd/
##its-margin:1.0
docker build --rm=true --no-cache=false -t its-margin:1.0 1Dockerfile/03its-margin/
##its-td:1.0
docker build --rm=true --no-cache=false -t its-td:1.0 1Dockerfile/04its-td/
##its-forward:1.0
docker build --rm=true --no-cache=false -t its-forward:1.0 1Dockerfile/05its-forward/
##its-cust:1.0
docker build --rm=true --no-cache=false -t its-cust:1.0 1Dockerfile/06its-cust/
##its-price:1.0
docker build --rm=true --no-cache=false -t its-price:1.0 1Dockerfile/07its-price/
##its-manage:1.0
docker build --rm=true --no-cache=false -t its-manage:1.0 1Dockerfile/08its-manage/
##its-batch:1.0
docker build --rm=true --no-cache=false -t its-batch:1.0 1Dockerfile/09its-batch/
##its-bigdata:1.0
docker build --rm=true --no-cache=false -t its-bigdata:1.0 1Dockerfile/10its-bigdata/

<font color="red" size="5"> 直接执行,所有镜像制作成功</font>


build执行情况日志:

localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-image-base:1.0 1Dockerfile/00its-image-base/
Sending build context to Docker daemon    189MB
Step 1/16 : FROM centos:7.4.1708
 ---> 3afd47092a0e
Step 2/16 : MAINTAINER Will wangzhenwei@erayt.com
 ---> Using cache
 ---> 18f37c166e2e
Step 3/16 : RUN mkdir /usr/soft
 ---> Using cache
 ---> f80d65eee5a5
Step 4/16 : RUN mkdir /usr/local/jdk
 ---> Using cache
 ---> e7be9f11d885
Step 5/16 : COPY jdk-8u60-linux-x64.tar.gz /usr/soft/jdk-8u60-linux-x64.tar.gz
 ---> 5e4874cc9379
Removing intermediate container d5fe2552cffc
Step 6/16 : RUN tar xvf /usr/soft/jdk-8u60-linux-x64.tar.gz -C /usr/local/jdk
 ---> Running in e61e6f0fe669
jdk1.8.0_60/
....省略
jdk1.8.0_60/release
 ---> db49ab363922
Removing intermediate container e61e6f0fe669
Step 7/16 : RUN rm -rf /usr/soft/jdk-8u60-linux-x64.tar.gz
 ---> Running in b1ec29837a19
 ---> 09f53ba58fa3
Removing intermediate container b1ec29837a19
Step 8/16 : RUN mkdir -p /usr/local/work/tomcat
 ---> Running in b630fdd5301d
 ---> a36db1fe8b51
Removing intermediate container b630fdd5301d
Step 9/16 : COPY apache-tomcat-7.0.34.tar.gz /usr/soft/apache-tomcat-7.0.34.tar.gz
 ---> fb23dfd5122b
Removing intermediate container 0a733616d4d9
Step 10/16 : RUN tar xvf /usr/soft/apache-tomcat-7.0.34.tar.gz  -C /usr/local/work/tomcat
 ---> Running in 5538505516fd
apache-tomcat-7.0.34/bin/catalina.sh
....省略
apache-tomcat-7.0.34/webapps/manager/xform.xsl
 ---> 76f846827158
Removing intermediate container 5538505516fd
Step 11/16 : RUN rm -rf /usr/soft/apache-tomcat-7.0.34.tar.gz
 ---> Running in bd541bffc47f
 ---> 7e63114de4ec
Removing intermediate container bd541bffc47f
Step 12/16 : ENV JAVA_HOME /usr/local/jdk/jdk1.8.0_60
 ---> Running in acc62ff41fdc
 ---> d0b0b488f7d6
Removing intermediate container acc62ff41fdc
Step 13/16 : ENV CATALINA_HOME /usr/local/work/tomcat/apache-tomcat-7.0.34
 ---> Running in ca28fa816a92
 ---> e74e966ab476
Removing intermediate container ca28fa816a92
Step 14/16 : ENV PATH $PATH:$JAVA_HOME/bin:$CATCHA_HOME/bin
 ---> Running in 5d9bbce26569
 ---> 351822198b86
Removing intermediate container 5d9bbce26569
Step 15/16 : EXPOSE 8080
 ---> Running in d88c1d77293e
 ---> e8ad0c1f271b
Removing intermediate container d88c1d77293e
Step 16/16 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run
 ---> Running in 81f6b1bcc102
 ---> 1362ffd827f7
Removing intermediate container 81f6b1bcc102
Successfully built 1362ffd827f7
Successfully tagged its-image-base:1.0
localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-xnetd:1.0 1Dockerfile/02its-xnetd/
Sending build context to Docker daemon  1.182MB
Step 1/10 : FROM centos:7.4.1708
 ---> 3afd47092a0e
Step 2/10 : MAINTAINER Will wangzhenwei@erayt.com
 ---> Using cache
 ---> 18f37c166e2e
Step 3/10 : RUN mkdir  /usr/xnetd_bin
 ---> Using cache
 ---> 50c37da1185f
Step 4/10 : COPY xnetd_bin/xnetd /usr/xnetd_bin/xnetd
 ---> d72a35b8a725
Removing intermediate container 6bbf1a95a550
Step 5/10 : COPY xnetd_bin/start.sh /usr/xnetd_bin/start.sh
 ---> 1e5c2f696f9d
Removing intermediate container 84416e39cfbe
Step 6/10 : COPY xnetd_bin/.config /root/.config
 ---> e92557b38cc6
Removing intermediate container 48fb09082c33
Step 7/10 : RUN mkdir -p /root/logs/13300/xnetd
 ---> Running in ba91f717a5b4
 ---> 76171c21d3e9
Removing intermediate container ba91f717a5b4
Step 8/10 : RUN mkdir -p /root/logs/17300/xnetd
 ---> Running in 51d1d489dbea
 ---> bdb2ee1bcb18
Removing intermediate container 51d1d489dbea
Step 9/10 : EXPOSE 13300 17300
 ---> Running in 873e4cebf5bf
 ---> 5f921045e8dd
Removing intermediate container 873e4cebf5bf
Step 10/10 : CMD sh /usr/xnetd_bin/start.sh && tail -f /root/.config
 ---> Running in a7baa475233d
 ---> 84a490a2c595
Removing intermediate container a7baa475233d
Successfully built 84a490a2c595
Successfully tagged its-xnetd:1.0
localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-margin:1.0 1Dockerfile/03its-margin/
Sending build context to Docker daemon  131.4MB
Step 1/6 : FROM its-image-base:1.0
 ---> 1362ffd827f7
Step 2/6 : MAINTAINER Will wangzhenwei@erayt.com
 ---> Running in 66ea96aa8968
 ---> 15180ae8da59
Removing intermediate container 66ea96aa8968
Step 3/6 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/marginTrade
 ---> Running in b7beb6d1fdd5
 ---> 5af619496e06
Removing intermediate container b7beb6d1fdd5
Step 4/6 : COPY marginTrade /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/marginTrade
 ---> 7192873ff0cd
Removing intermediate container f6b958545357
Step 5/6 : EXPOSE 9990
 ---> Running in 6e86e5b7fd09
 ---> a9e454ae9be2
Removing intermediate container 6e86e5b7fd09
Step 6/6 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run
 ---> Running in 88117f4e802a
 ---> 969a80689257
Removing intermediate container 88117f4e802a
Successfully built 969a80689257
Successfully tagged its-margin:1.0
localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-td:1.0 1Dockerfile/04its-td/
Sending build context to Docker daemon  81.15MB
Step 1/5 : FROM its-image-base:1.0
 ---> 1362ffd827f7
Step 2/5 : MAINTAINER Will wangzhenwei@erayt.com
 ---> Using cache
 ---> 15180ae8da59
Step 3/5 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/sgeb
 ---> Running in c6bcdd4a7bad
 ---> 3ee59600bae1
Removing intermediate container c6bcdd4a7bad
Step 4/5 : COPY sgeb /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/sgeb
 ---> c7e3b29daf58
Removing intermediate container b91bcd2148f4
Step 5/5 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run
 ---> Running in 8171c20933f9
 ---> 920ff7dfa45b
Removing intermediate container 8171c20933f9
Successfully built 920ff7dfa45b
Successfully tagged its-td:1.0
localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-forward:1.0 1Dockerfile/05its-forward/
Sending build context to Docker daemon  164.2MB
Step 1/6 : FROM its-image-base:1.0
 ---> 1362ffd827f7
Step 2/6 : MAINTAINER Will wangzhenwei@erayt.com
 ---> Using cache
 ---> 15180ae8da59
Step 3/6 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/forward
 ---> Running in e65d6125bea6
 ---> c8357d8fb7bc
Removing intermediate container e65d6125bea6
Step 4/6 : COPY forward /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/forward
 ---> 55054c03a74e
Removing intermediate container c6f3560618d0
Step 5/6 : EXPOSE 8080
 ---> Running in 8cb93c22f738
 ---> 73a01e9c783d
Removing intermediate container 8cb93c22f738
Step 6/6 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run
 ---> Running in 19c9d62f85f1
 ---> 94997aeeee5e
Removing intermediate container 19c9d62f85f1
Successfully built 94997aeeee5e
Successfully tagged its-forward:1.0
localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-cust:1.0 1Dockerfile/06its-cust/
Sending build context to Docker daemon  403.2MB
Step 1/8 : FROM its-image-base:1.0
 ---> 1362ffd827f7
Step 2/8 : MAINTAINER Will wangzhenwei@erayt.com
 ---> Using cache
 ---> 15180ae8da59
Step 3/8 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/cim
 ---> Running in 5cc6f622c706
 ---> 7c158c3724ee
Removing intermediate container 5cc6f622c706
Step 4/8 : COPY cim /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/cim
 ---> accb1058819c
Removing intermediate container d74c067399a2
Step 5/8 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/xacc
 ---> Running in 68734b119af4
 ---> 1af5148fc374
Removing intermediate container 68734b119af4
Step 6/8 : COPY xacc /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/xacc
 ---> fd0c050263c9
Removing intermediate container 82a7b5fcb5d9
Step 7/8 : EXPOSE 9992 9991
 ---> Running in e7a3bfcb2ebf
 ---> a1d12331f930
Removing intermediate container e7a3bfcb2ebf
Step 8/8 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run
 ---> Running in 45f2b64ef8db
 ---> c735b8507c90
Removing intermediate container 45f2b64ef8db
Successfully built c735b8507c90
Successfully tagged its-cust:1.0
localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-price:1.0 1Dockerfile/07its-price/
Sending build context to Docker daemon  172.9MB
Step 1/8 : FROM its-image-base:1.0
 ---> 1362ffd827f7
Step 2/8 : MAINTAINER Will wangzhenwei@erayt.com
 ---> Using cache
 ---> 15180ae8da59
Step 3/8 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/info
 ---> Running in 1ea982c39ccf
 ---> 9049a53d187b
Removing intermediate container 1ea982c39ccf
Step 4/8 : COPY info /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/info
 ---> d78c1aff8a8e
Removing intermediate container 9b8bed7bf025
Step 5/8 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/quotation
 ---> Running in 96be890e55ef
 ---> d45603d20994
Removing intermediate container 96be890e55ef
Step 6/8 : COPY quotation /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/quotation
 ---> 817c48a4091b
Removing intermediate container f1e9cc5e44c6
Step 7/8 : EXPOSE 9990
 ---> Running in 44ff6288583b
 ---> 2e74528209d8
Removing intermediate container 44ff6288583b
Step 8/8 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run
 ---> Running in 6eb7734914a9
 ---> 9771a8b660bd
Removing intermediate container 6eb7734914a9
Successfully built 9771a8b660bd
Successfully tagged its-price:1.0
localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-manage:1.0 1Dockerfile/08its-manage/
Sending build context to Docker daemon  324.7MB
Step 1/10 : FROM its-image-base:1.0
 ---> 1362ffd827f7
Step 2/10 : MAINTAINER Will wangzhenwei@erayt.com
 ---> Using cache
 ---> 15180ae8da59
Step 3/10 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/callOrder
 ---> Running in 79eec2e2ab6d
 ---> 4b1872084ff1
Removing intermediate container 79eec2e2ab6d
Step 4/10 : COPY callOrder /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/callOrder
 ---> 649a6143473b
Removing intermediate container 61218f46a044
Step 5/10 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/ecas
 ---> Running in 2dbaf106895a
 ---> 974728901303
Removing intermediate container 2dbaf106895a
Step 6/10 : COPY ecas /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/ecas
 ---> 49e7af424594
Removing intermediate container b0b1db9b84c4
Step 7/10 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/simManage
 ---> Running in 6cfab4758048
 ---> e6200c1a4fbc
Removing intermediate container 6cfab4758048
Step 8/10 : COPY simManage /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/simManage
 ---> e24eb4799474
Removing intermediate container 1cba973cafae
Step 9/10 : EXPOSE 9993 9994 8080
 ---> Running in ac805a94da61
 ---> ae57411516bf
Removing intermediate container ac805a94da61
Step 10/10 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run
 ---> Running in cdf295850084
 ---> 751e3f88905c
Removing intermediate container cdf295850084
Successfully built 751e3f88905c
Successfully tagged its-manage:1.0
localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-batch:1.0 1Dockerfile/09its-batch/
Sending build context to Docker daemon  304.3MB
Step 1/7 : FROM its-image-base:1.0
 ---> 1362ffd827f7
Step 2/7 : MAINTAINER Will wangzhenwei@erayt.com
 ---> Using cache
 ---> 15180ae8da59
Step 3/7 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/eops
 ---> Running in 88a25f6b1c95
 ---> bf528afd9e34
Removing intermediate container 88a25f6b1c95
Step 4/7 : COPY eops /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/eops
 ---> 823065e2081d
Removing intermediate container 336c468298be
Step 5/7 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/marginBatch
 ---> Running in 3b1a3e1d3062
 ---> ee8aff5f37e2
Removing intermediate container 3b1a3e1d3062
Step 6/7 : COPY marginBatch /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/marginBatch
 ---> 860c40504adf
Removing intermediate container 21dc27f5ac26
Step 7/7 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run
 ---> Running in 18b1b0e5dcaa
 ---> 02439a601ceb
Removing intermediate container 18b1b0e5dcaa
Successfully built 02439a601ceb
Successfully tagged its-batch:1.0
localhost:sim_docker wangzhenwei$ docker build --rm=true --no-cache=false -t its-bigdata:1.0 1Dockerfile/10its-bigdata/
Sending build context to Docker daemon  58.01MB
Step 1/5 : FROM its-image-base:1.0
 ---> 1362ffd827f7
Step 2/5 : MAINTAINER Will wangzhenwei@erayt.com
 ---> Using cache
 ---> 15180ae8da59
Step 3/5 : RUN mkdir /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/GEnquiry
 ---> Running in 6d7737a02cac
 ---> c2e231b1c4e2
Removing intermediate container 6d7737a02cac
Step 4/5 : COPY GEnquiry /usr/local/work/tomcat/apache-tomcat-7.0.34/webapps/GEnquiry
 ---> ca1a5038a4d4
Removing intermediate container 824f5238cb77
Step 5/5 : CMD ./usr/local/work/tomcat/apache-tomcat-7.0.34/bin/catalina.sh run
 ---> Running in 6857f922ef25
 ---> 060e9de6513a
Removing intermediate container 6857f922ef25
Successfully built 060e9de6513a
Successfully tagged its-bigdata:1.0
localhost:sim_docker wangzhenwei$ docker images
REPOSITORY                     TAG                 IMAGE ID            CREATED             SIZE
its-bigdata                    1.0                 060e9de6513a        16 minutes ago      820MB
its-batch                      1.0                 02439a601ceb        16 minutes ago      1.07GB
its-manage                     1.0                 751e3f88905c        17 minutes ago      1.09GB
its-price                      1.0                 9771a8b660bd        17 minutes ago      935MB
its-cust                       1.0                 c735b8507c90        17 minutes ago      1.16GB
its-forward                    1.0                 94997aeeee5e        18 minutes ago      926MB
its-td                         1.0                 920ff7dfa45b        18 minutes ago      842MB
its-margin                     1.0                 969a80689257        18 minutes ago      893MB
its-xnetd                      1.0                 84a490a2c595        19 minutes ago      198MB
its-image-base                 1.0                 1362ffd827f7        21 minutes ago      762MB
目录
相关文章
|
7月前
|
缓存 安全 Docker
《Docker 简易速速上手小册》第3章 Dockerfile 与镜像构建(2024 最新版)
《Docker 简易速速上手小册》第3章 Dockerfile 与镜像构建(2024 最新版)
133 0
|
2月前
|
JSON JavaScript 测试技术
【Docker项目实战】使用Docker部署PPTist在线演示文稿应用
【10月更文挑战第9天】使用Docker部署PPTist在线演示文稿应用
43 1
【Docker项目实战】使用Docker部署PPTist在线演示文稿应用
|
3月前
|
关系型数据库 应用服务中间件 虚拟化
镜像制作
镜像制作
48 2
|
5月前
|
Kubernetes 搜索推荐 应用服务中间件
制作KubeVirt镜像
制作KubeVirt镜像
136 13
|
7月前
|
存储 数据挖掘 Docker
《Docker 简易速速上手小册》第2章 容器和镜像(2024 最新版)
《Docker 简易速速上手小册》第2章 容器和镜像(2024 最新版)
449 0
|
7月前
|
存储 监控 Docker
《Docker 简易速速上手小册》第7章 高级容器管理(2024 最新版)
《Docker 简易速速上手小册》第7章 高级容器管理(2024 最新版)
67 0
|
Java 开发工具 git
体验SpringBoot(2.3)应用制作Docker镜像(官方方案)
2.3版本的SpringBoot,推荐了新的docker镜像构建方案,一起来实践吧
234 0
体验SpringBoot(2.3)应用制作Docker镜像(官方方案)
|
Kubernetes Java Devops
详解SpringBoot(2.3)应用制作Docker镜像(官方方案)
学习SpringBoot官方镜像方案的细节
578 0
详解SpringBoot(2.3)应用制作Docker镜像(官方方案)
|
应用服务中间件 Linux Shell
Dockerfile 制作镜像|学习笔记
快速学习 Dockerfile 制作镜像
Dockerfile 制作镜像|学习笔记
|
安全 开发者 Docker
镜像制作的方式介绍|学习笔记
快速学习镜像制作的方式介绍
下一篇
无影云桌面