1. 程式人生 > >第 3 章 映象 - 013 - Dockerfile 構建映象

第 3 章 映象 - 013 - Dockerfile 構建映象

第一個 Dockerfile

1 FROM ubuntu
2 RUN apt-get update && apt-get install -y vim

 執行 docker build 命令構建映象並詳細分析每個細節

  1 [email protected]:~# pwd
  2 /root
  3 [email protected]:~#
  4 [email protected]:~# cat Dockerfile 
  5 FROM ubuntu
  6 RUN apt-get update && apt-get install
-y vim 7 [email protected]:~# 8 [email protected]:~# docker build -t ubuntu-with-vi-dockerfile . 9 Sending build context to Docker daemon 24.06kB 10 Step 1/2 : FROM ubuntu 11 ---> 1d9c17228a9e 12 Step 2/2 : RUN apt-get update && apt-get install -y vim 13 ---> Running in
1ffb347c507f 14 Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB] 15 Get:2 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB] 16 Get:3 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [1367 B] 17 Get:4 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [135 kB]
18 Get:5 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB] 19 Get:6 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [300 kB] 20 Get:7 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB] 21 Get:8 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1344 kB] 22 Get:9 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [13.5 kB] 23 Get:10 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB] 24 Get:11 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [186 kB] 25 Get:12 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [10.7 kB] 26 Get:13 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [6931 B] 27 Get:14 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [900 kB] 28 Get:15 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [618 kB] 29 Get:16 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [3655 B] 30 Fetched 15.3 MB in 48s (321 kB/s) 31 Reading package lists... 32 Reading package lists... 33 Building dependency tree... 34 Reading state information... 35 The following additional packages will be installed: 36 file libexpat1 libgpm2 libmagic-mgc libmagic1 libmpdec2 libpython3.6 37 libpython3.6-minimal libpython3.6-stdlib libreadline7 libsqlite3-0 libssl1.1 38 mime-support readline-common vim-common vim-runtime xxd xz-utils 39 Suggested packages: 40 gpm readline-doc ctags vim-doc vim-scripts 41 The following NEW packages will be installed: 42 file libexpat1 libgpm2 libmagic-mgc libmagic1 libmpdec2 libpython3.6 43 libpython3.6-minimal libpython3.6-stdlib libreadline7 libsqlite3-0 libssl1.1 44 mime-support readline-common vim vim-common vim-runtime xxd xz-utils 45 0 upgraded, 19 newly installed, 0 to remove and 0 not upgraded. 46 Need to get 12.7 MB of archives. 47 After this operation, 61.0 MB of additional disk space will be used. 48 Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic-mgc amd64 1:5.32-2ubuntu0.1 [184 kB] 49 Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic1 amd64 1:5.32-2ubuntu0.1 [68.4 kB] 50 Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 file amd64 1:5.32-2ubuntu0.1 [22.1 kB] 51 Get:4 http://archive.ubuntu.com/ubuntu bionic/main amd64 libexpat1 amd64 2.2.5-3 [80.2 kB] 52 Get:5 http://archive.ubuntu.com/ubuntu bionic/main amd64 libmpdec2 amd64 2.4.2-1ubuntu1 [84.1 kB] 53 Get:6 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libssl1.1 amd64 1.1.0g-2ubuntu4.3 [1130 kB] 54 Get:7 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython3.6-minimal amd64 3.6.7-1~18.04 [531 kB] 55 Get:8 http://archive.ubuntu.com/ubuntu bionic/main amd64 mime-support all 3.60ubuntu1 [30.1 kB] 56 Get:9 http://archive.ubuntu.com/ubuntu bionic/main amd64 readline-common all 7.0-3 [52.9 kB] 57 Get:10 http://archive.ubuntu.com/ubuntu bionic/main amd64 libreadline7 amd64 7.0-3 [124 kB] 58 Get:11 http://archive.ubuntu.com/ubuntu bionic/main amd64 libsqlite3-0 amd64 3.22.0-1 [496 kB] 59 Get:12 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython3.6-stdlib amd64 3.6.7-1~18.04 [1711 kB] 60 Get:13 http://archive.ubuntu.com/ubuntu bionic/main amd64 xxd amd64 2:8.0.1453-1ubuntu1 [49.2 kB] 61 Get:14 http://archive.ubuntu.com/ubuntu bionic/main amd64 vim-common all 2:8.0.1453-1ubuntu1 [70.4 kB] 62 Get:15 http://archive.ubuntu.com/ubuntu bionic/main amd64 xz-utils amd64 5.2.2-1.3 [83.8 kB] 63 Get:16 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgpm2 amd64 1.20.7-5 [15.1 kB] 64 Get:17 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython3.6 amd64 3.6.7-1~18.04 [1415 kB] 65 Get:18 http://archive.ubuntu.com/ubuntu bionic/main amd64 vim-runtime all 2:8.0.1453-1ubuntu1 [5437 kB] 66 Get:19 http://archive.ubuntu.com/ubuntu bionic/main amd64 vim amd64 2:8.0.1453-1ubuntu1 [1152 kB] 67 debconf: delaying package configuration, since apt-utils is not installed 68 Fetched 12.7 MB in 38s (332 kB/s) 69 Selecting previously unselected package libmagic-mgc. 70 (Reading database ... 4039 files and directories currently installed.) 71 Preparing to unpack .../00-libmagic-mgc_1%3a5.32-2ubuntu0.1_amd64.deb ... 72 Unpacking libmagic-mgc (1:5.32-2ubuntu0.1) ... 73 Selecting previously unselected package libmagic1:amd64. 74 Preparing to unpack .../01-libmagic1_1%3a5.32-2ubuntu0.1_amd64.deb ... 75 Unpacking libmagic1:amd64 (1:5.32-2ubuntu0.1) ... 76 Selecting previously unselected package file. 77 Preparing to unpack .../02-file_1%3a5.32-2ubuntu0.1_amd64.deb ... 78 Unpacking file (1:5.32-2ubuntu0.1) ... 79 Selecting previously unselected package libexpat1:amd64. 80 Preparing to unpack .../03-libexpat1_2.2.5-3_amd64.deb ... 81 Unpacking libexpat1:amd64 (2.2.5-3) ... 82 Selecting previously unselected package libmpdec2:amd64. 83 Preparing to unpack .../04-libmpdec2_2.4.2-1ubuntu1_amd64.deb ... 84 Unpacking libmpdec2:amd64 (2.4.2-1ubuntu1) ... 85 Selecting previously unselected package libssl1.1:amd64. 86 Preparing to unpack .../05-libssl1.1_1.1.0g-2ubuntu4.3_amd64.deb ... 87 Unpacking libssl1.1:amd64 (1.1.0g-2ubuntu4.3) ... 88 Selecting previously unselected package libpython3.6-minimal:amd64. 89 Preparing to unpack .../06-libpython3.6-minimal_3.6.7-1~18.04_amd64.deb ... 90 Unpacking libpython3.6-minimal:amd64 (3.6.7-1~18.04) ... 91 Selecting previously unselected package mime-support. 92 Preparing to unpack .../07-mime-support_3.60ubuntu1_all.deb ... 93 Unpacking mime-support (3.60ubuntu1) ... 94 Selecting previously unselected package readline-common. 95 Preparing to unpack .../08-readline-common_7.0-3_all.deb ... 96 Unpacking readline-common (7.0-3) ... 97 Selecting previously unselected package libreadline7:amd64. 98 Preparing to unpack .../09-libreadline7_7.0-3_amd64.deb ... 99 Unpacking libreadline7:amd64 (7.0-3) ... 100 Selecting previously unselected package libsqlite3-0:amd64. 101 Preparing to unpack .../10-libsqlite3-0_3.22.0-1_amd64.deb ... 102 Unpacking libsqlite3-0:amd64 (3.22.0-1) ... 103 Selecting previously unselected package libpython3.6-stdlib:amd64. 104 Preparing to unpack .../11-libpython3.6-stdlib_3.6.7-1~18.04_amd64.deb ... 105 Unpacking libpython3.6-stdlib:amd64 (3.6.7-1~18.04) ... 106 Selecting previously unselected package xxd. 107 Preparing to unpack .../12-xxd_2%3a8.0.1453-1ubuntu1_amd64.deb ... 108 Unpacking xxd (2:8.0.1453-1ubuntu1) ... 109 Selecting previously unselected package vim-common. 110 Preparing to unpack .../13-vim-common_2%3a8.0.1453-1ubuntu1_all.deb ... 111 Unpacking vim-common (2:8.0.1453-1ubuntu1) ... 112 Selecting previously unselected package xz-utils. 113 Preparing to unpack .../14-xz-utils_5.2.2-1.3_amd64.deb ... 114 Unpacking xz-utils (5.2.2-1.3) ... 115 Selecting previously unselected package libgpm2:amd64. 116 Preparing to unpack .../15-libgpm2_1.20.7-5_amd64.deb ... 117 Unpacking libgpm2:amd64 (1.20.7-5) ... 118 Selecting previously unselected package libpython3.6:amd64. 119 Preparing to unpack .../16-libpython3.6_3.6.7-1~18.04_amd64.deb ... 120 Unpacking libpython3.6:amd64 (3.6.7-1~18.04) ... 121 Selecting previously unselected package vim-runtime. 122 Preparing to unpack .../17-vim-runtime_2%3a8.0.1453-1ubuntu1_all.deb ... 123 Adding 'diversion of /usr/share/vim/vim80/doc/help.txt to /usr/share/vim/vim80/doc/help.txt.vim-tiny by vim-runtime' 124 Adding 'diversion of /usr/share/vim/vim80/doc/tags to /usr/share/vim/vim80/doc/tags.vim-tiny by vim-runtime' 125 Unpacking vim-runtime (2:8.0.1453-1ubuntu1) ... 126 Selecting previously unselected package vim. 127 Preparing to unpack .../18-vim_2%3a8.0.1453-1ubuntu1_amd64.deb ... 128 Unpacking vim (2:8.0.1453-1ubuntu1) ... 129 Setting up readline-common (7.0-3) ... 130 Setting up libexpat1:amd64 (2.2.5-3) ... 131 Setting up mime-support (3.60ubuntu1) ... 132 Setting up xxd (2:8.0.1453-1ubuntu1) ... 133 Setting up libgpm2:amd64 (1.20.7-5) ... 134 Setting up libreadline7:amd64 (7.0-3) ... 135 Setting up libmagic-mgc (1:5.32-2ubuntu0.1) ... 136 Setting up libmagic1:amd64 (1:5.32-2ubuntu0.1) ... 137 Processing triggers for libc-bin (2.27-3ubuntu1) ... 138 Setting up libssl1.1:amd64 (1.1.0g-2ubuntu4.3) ... 139 debconf: unable to initialize frontend: Dialog 140 debconf: (TERM is not set, so the dialog frontend is not usable.) 141 debconf: falling back to frontend: Readline 142 debconf: unable to initialize frontend: Readline 143 debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.) 144 debconf: falling back to frontend: Teletype 145 Setting up xz-utils (5.2.2-1.3) ... 146 update-alternatives: using /usr/bin/xz to provide /usr/bin/lzma (lzma) in auto mode 147 update-alternatives: warning: skip creation of /usr/share/man/man1/lzma.1.gz because associated file /usr/share/man/man1/xz.1.gz (of link group lzma) doesn't exist 148 update-alternatives: warning: skip creation of /usr/share/man/man1/unlzma.1.gz because associated file /usr/share/man/man1/unxz.1.gz (of link group lzma) doesn't exist 149 update-alternatives: warning: skip creation of /usr/share/man/man1/lzcat.1.gz because associated file /usr/share/man/man1/xzcat.1.gz (of link group lzma) doesn't exist 150 update-alternatives: warning: skip creation of /usr/share/man/man1/lzmore.1.gz because associated file /usr/share/man/man1/xzmore.1.gz (of link group lzma) doesn't exist 151 update-alternatives: warning: skip creation of /usr/share/man/man1/lzless.1.gz because associated file /usr/share/man/man1/xzless.1.gz (of link group lzma) doesn't exist 152 update-alternatives: warning: skip creation of /usr/share/man/man1/lzdiff.1.gz because associated file /usr/share/man/man1/xzdiff.1.gz (of link group lzma) doesn't exist 153 update-alternatives: warning: skip creation of /usr/share/man/man1/lzcmp.1.gz because associated file /usr/share/man/man1/xzcmp.1.gz (of link group lzma) doesn't exist 154 update-alternatives: warning: skip creation of /usr/share/man/man1/lzgrep.1.gz because associated file /usr/share/man/man1/xzgrep.1.gz (of link group lzma) doesn't exist 155 update-alternatives: warning: skip creation of /usr/share/man/man1/lzegrep.1.gz because associated file /usr/share/man/man1/xzegrep.1.gz (of link group lzma) doesn't exist 156 update-alternatives: warning: skip creation of /usr/share/man/man1/lzfgrep.1.gz because associated file /usr/share/man/man1/xzfgrep.1.gz (of link group lzma) doesn't exist 157 Setting up vim-common (2:8.0.1453-1ubuntu1) ... 158 Setting up libsqlite3-0:amd64 (3.22.0-1) ... 159 Setting up vim-runtime (2:8.0.1453-1ubuntu1) ... 160 Setting up libmpdec2:amd64 (2.4.2-1ubuntu1) ... 161 Setting up file (1:5.32-2ubuntu0.1) ... 162 Setting up libpython3.6-minimal:amd64 (3.6.7-1~18.04) ... 163 Setting up libpython3.6-stdlib:amd64 (3.6.7-1~18.04) ... 164 Setting up libpython3.6:amd64 (3.6.7-1~18.04) ... 165 Setting up vim (2:8.0.1453-1ubuntu1) ... 166 update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vim (vim) in auto mode 167 update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vimdiff (vimdiff) in auto mode 168 update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rvim (rvim) in auto mode 169 update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/rview (rview) in auto mode 170 update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/vi (vi) in auto mode 171 update-alternatives: warning: skip creation of /usr/share/man/fr/man1/vi.1.gz because associated file /usr/share/man/fr/man1/vim.1.gz (of link group vi) doesn't exist 172 update-alternatives: warning: skip creation of /usr/share/man/it/man1/vi.1.gz because associated file /usr/share/man/it/man1/vim.1.gz (of link group vi) doesn't exist 173 update-alternatives: warning: skip creation of /usr/share/man/pl/man1/vi.1.gz because associated file /usr/share/man/pl/man1/vim.1.gz (of link group vi) doesn't exist 174 update-alternatives: warning: skip creation of /usr/share/man/ru/man1/vi.1.gz because associated file /usr/share/man/ru/man1/vim.1.gz (of link group vi) doesn't exist 175 update-alternatives: warning: skip creation of /usr/share/man/ja/man1/vi.1.gz because associated file /usr/share/man/ja/man1/vim.1.gz (of link group vi) doesn't exist 176 update-alternatives: warning: skip creation of /usr/share/man/man1/vi.1.gz because associated file /usr/share/man/man1/vim.1.gz (of link group vi) doesn't exist 177 update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/view (view) in auto mode 178 update-alternatives: warning: skip creation of /usr/share/man/fr/man1/view.1.gz because associated file /usr/share/man/fr/man1/vim.1.gz (of link group view) doesn't exist 179 update-alternatives: warning: skip creation of /usr/share/man/it/man1/view.1.gz because associated file /usr/share/man/it/man1/vim.1.gz (of link group view) doesn't exist 180 update-alternatives: warning: skip creation of /usr/share/man/pl/man1/view.1.gz because associated file /usr/share/man/pl/man1/vim.1.gz (of link group view) doesn't exist 181 update-alternatives: warning: skip creation of /usr/share/man/ru/man1/view.1.gz because associated file /usr/share/man/ru/man1/vim.1.gz (of link group view) doesn't exist 182 update-alternatives: warning: skip creation of /usr/share/man/ja/man1/view.1.gz because associated file /usr/share/man/ja/man1/vim.1.gz (of link group view) doesn't exist 183 update-alternatives: warning: skip creation of /usr/share/man/man1/view.1.gz because associated file /usr/share/man/man1/vim.1.gz (of link group view) doesn't exist 184 update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/ex (ex) in auto mode 185 update-alternatives: warning: skip creation of /usr/share/man/fr/man1/ex.1.gz because associated file /usr/share/man/fr/man1/vim.1.gz (of link group ex) doesn't exist 186 update-alternatives: warning: skip creation of /usr/share/man/it/man1/ex.1.gz because associated file /usr/share/man/it/man1/vim.1.gz (of link group ex) doesn't exist 187 update-alternatives: warning: skip creation of /usr/share/man/pl/man1/ex.1.gz because associated file /usr/share/man/pl/man1/vim.1.gz (of link group ex) doesn't exist 188 update-alternatives: warning: skip creation of /usr/share/man/ru/man1/ex.1.gz because associated file /usr/share/man/ru/man1/vim.1.gz (of link group ex) doesn't exist 189 update-alternatives: warning: skip creation of /usr/share/man/ja/man1/ex.1.gz because associated file /usr/share/man/ja/man1/vim.1.gz (of link group ex) doesn't exist 190 update-alternatives: warning: skip creation of /usr/share/man/man1/ex.1.gz because associated file /usr/share/man/man1/vim.1.gz (of link group ex) doesn't exist 191 update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in auto mode 192 update-alternatives: warning: skip creation of /usr/share/man/fr/man1/editor.1.gz because associated file /usr/share/man/fr/man1/vim.1.gz (of link group editor) doesn't exist 193 update-alternatives: warning: skip creation of /usr/share/man/it/man1/editor.1.gz because associated file /usr/share/man/it/man1/vim.1.gz (of link group editor) doesn't exist 194 update-alternatives: warning: skip creation of /usr/share/man/pl/man1/editor.1.gz because associated file /usr/share/man/pl/man1/vim.1.gz (of link group editor) doesn't exist 195 update-alternatives: warning: skip creation of /usr/share/man/ru/man1/editor.1.gz because associated file /usr/share/man/ru/man1/vim.1.gz (of link group editor) doesn't exist 196 update-alternatives: warning: skip creation of /usr/share/man/ja/man1/editor.1.gz because associated file /usr/share/man/ja/man1/vim.1.gz (of link group editor) doesn't exist 197 update-alternatives: warning: skip creation of /usr/share/man/man1/editor.1.gz because associated file /usr/share/man/man1/vim.1.gz (of link group editor) doesn't exist 198 Processing triggers for libc-bin (2.27-3ubuntu1) ... 199 Removing intermediate container 1ffb347c507f 200 ---> 1e996ab06bb9 201 Successfully built 1e996ab06bb9 202 Successfully tagged ubuntu-with-vi-dockerfile:latest 203 [email protected]:~# 204 [email protected]:~# docker images 205 REPOSITORY TAG IMAGE ID CREATED SIZE 206 ubuntu-with-vi-dockerfile latest 1e996ab06bb9 5 minutes ago 170MB 207 ubuntu-with-vi latest b5410dfa9a42 5 days ago 170MB 208 ubuntu latest 1d9c17228a9e 5 days ago 86.7MB 209 [email protected]:~#
  1. 當前目錄為 /root
  2. 準備Dockerfile
  3. 執行 docker build 命令,-t 指定新映象名ubuntu-with-vi-dockerfile,命令末尾的 . 指明 build context 為當前目錄。Docker 預設會從 build context 中查詢 Dockerfile 檔案,我們也可以通過 -f 引數指定 Dockerfile 的位置。
  4. 映象真正的構建過程,Docker 將 build context 中的所有檔案傳送給 Docker daemon。build context 為映象構建提供所需要的檔案或目錄。 Dockerfile 中的 ADD、COPY 等命令可以將 build context 中的檔案新增到映象。注:build context 為當前目錄 /root,該目錄下的所有檔案和子目錄都會被髮送給 Docker daemon。所以不要將多餘檔案放到 build context,特別不要把 //usr 作為 build context,否則構建過程會相當緩慢甚至失敗。
  5. Step 1:執行 FROM,將 ubuntu 作為 base 映象。
  6. Step 2:執行 RUN,安裝 vim。
  7. 啟動臨時容器(1ffb347c507f),在容器中通過 apt-get 安裝 vim。
  8. 安裝成功後,將容器儲存為映象。這一步底層使用的是類似 docker commit 的命令。
  9. 刪除臨時容器 9f4d4166f7e3。
  10. 映象構建成功。 通過 docker images 檢視映象資訊

映象的構建歷史

docker history 會顯示映象的構建歷史,也就是 Dockerfile 的執行過程。

 1 [email protected]:~# docker history ubuntu
 2 IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
 3 1d9c17228a9e        5 days ago          /bin/sh -c #(nop)  CMD ["/bin/bash"]            0B                  
 4 <missing>           5 days ago          /bin/sh -c mkdir -p /run/systemd && echo 'do…   7B                  
 5 <missing>           5 days ago          /bin/sh -c rm -rf /var/lib/apt/lists/*          0B                  
 6 <missing>           5 days ago          /bin/sh -c set -xe   && echo '#!/bin/sh' > /…   745B                
 7 <missing>           5 days ago          /bin/sh -c #(nop) ADD file:c0f17c7189fc11b6a…   86.7MB              
 8 [email protected]:~# docker history ubuntu-with-vi-dockerfile:latest 
 9 IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
10 1e996ab06bb9        25 minutes ago      /bin/sh -c apt-get update && apt-get install…   83.8MB              
11 1d9c17228a9e        5 days ago          /bin/sh -c #(nop)  CMD ["/bin/bash"]            0B                  
12 <missing>           5 days ago          /bin/sh -c mkdir -p /run/systemd && echo 'do…   7B                  
13 <missing>           5 days ago          /bin/sh -c rm -rf /var/lib/apt/lists/*          0B                  
14 <missing>           5 days ago          /bin/sh -c set -xe   && echo '#!/bin/sh' > /…   745B                
15 <missing>           5 days ago          /bin/sh -c #(nop) ADD file:c0f17c7189fc11b6a…   86.7MB              
16 [email protected]:~# 

這個新映象層的內容由 RUN apt-get update && apt-get install -y vim 生成。

 

------------引用來自------------ 

https://mp.weixin.qq.com/s?__biz=MzIwMTM5MjUwMg==&mid=2653587598&idx=1&sn=d0952497b3a2272eee05cfb1e4e05e62&chksm=8d308097ba47098189b45ba63c4040cf94d687fb19c54b9cab593df9995612ce0b0632e9a54e&scene=21#wechat_redirect