|
@@ -1,10 +1,39 @@
|
|
|
# 1. 软件包里面的内容
|
|
|
|
|
|
+与非 Docker 化的软件相比,Docker 化时,我们放置一个 [ /docker/文件夹 及 /Dockerfile 文件 ](https://git.svicloud.com/svicloud/cloud-standard) 在 SVN 根目录中。
|
|
|
|
|
|
+由软件包转变为镜像,关键的一步是 Dockerfile,Dockerfile 中生成镜像的过程中,实际上是执行了传统意义上的“安装”过程,只是这个安装过程是一次性的,一次 Build,多次运行(安装命令见 图 1-1)。
|
|
|
+
|
|
|
+生成镜像后,镜像就可以分发至不同的主机上直接启动了,这过程有点类似` VM Clone` 过程。与 VM Clone 不同的是,容器的镜像,只能从镜像仓库里拉取。
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+<div class="warn">
|
|
|
+<h2>注意!</h2>
|
|
|
+<p>Dockerfile 中的自动化安装命令,是不能有等待用户输入项的,安装脚本中如有 read、input 等 命令时,可以使用 <a href="http://tldp.org/LDP/abs/html/here-docs.html">HERE DOCUMENT </a>的方式自动化输入。</p>
|
|
|
+</div>
|
|
|
|
|
|
# 2. build 镜像过程
|
|
|
|
|
|
+镜像 build 实际上包含 生成(build)、推送(push) 二个过程。
|
|
|
+
|
|
|
+## 2.1. build
|
|
|
+
|
|
|
+ - 业务镜像是由[基础镜像](https://git.svicloud.com/svicloud/dockerfile) (如下图 2.1-1)+ 用户安装的软件 + 启动入口 组成。
|
|
|
+ - Jenkins 通过 FTP 服务,将已经编译好的软件包传至 192.168.100.19 上的 /data/ftp/ 目录中(图 2.1-2)
|
|
|
+ - build 过程,由 Jenkins 进行主动调用,执行位于 192.168.100.19 上的 [/opt/tools/build_images.sh](https://git.svicloud.com/svicloud/cloud-standard/src/master/build)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
+## 2.2. push
|
|
|
|
|
|
+ - 镜像 push 向长沙本地镜像仓库,后再被自动化同步向其它仓库
|
|
|
+ - 镜像 push 时,会自动生成`当前软件版本标签`(规则见 图2.2-1)及`latest`二个标签,所以,用 latest 取到的镜像,永远是最新的镜像
|
|
|
+ -
|
|
|
|
|
|
-## 2.1. push
|
|
|
+
|