From a5876944d5ae0cf814b6a016b871d2dcc16e8a36 Mon Sep 17 00:00:00 2001 From: geminiyellow Date: Tue, 9 Feb 2016 14:13:01 +0900 Subject: [PATCH] =?UTF-8?q?docs(zh-cn):=20#69=20Update=20README=20?= =?UTF-8?q?=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds more context and information around how to minimize image layers --- zh-cn/README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/zh-cn/README.md b/zh-cn/README.md index c8e9858..f9d3d3d 100644 --- a/zh-cn/README.md +++ b/zh-cn/README.md @@ -522,10 +522,15 @@ docker images -viz | dot -Tpng -o docker.png ### Docker 容器瘦身 [Intercity 博客](http://bit.ly/1Wwo61N) -- 清理 APT +- 在当前运行层(RUN layer)清理 APT + +这应当和其他 apt 命令在同一层中完成。 +否则,前面的层将会保持原有信息,而你的镜像则依旧臃肿。 + ``` -RUN apt-get clean -RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN {apt commands} \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ``` - 压缩镜像 ```