mirror of
https://github.com/wsargent/docker-cheat-sheet.git
synced 2025-12-16 15:10:12 +01:00
docs(zh-cn): #69 Update README …
Adds more context and information around how to minimize image layers
This commit is contained in:
parent
ce0af89405
commit
a5876944d5
1 changed files with 8 additions and 3 deletions
|
|
@ -522,10 +522,15 @@ docker images -viz | dot -Tpng -o docker.png
|
||||||
|
|
||||||
### Docker 容器瘦身 [Intercity 博客](http://bit.ly/1Wwo61N)
|
### Docker 容器瘦身 [Intercity 博客](http://bit.ly/1Wwo61N)
|
||||||
|
|
||||||
- 清理 APT
|
- 在当前运行层(RUN layer)清理 APT
|
||||||
|
|
||||||
|
这应当和其他 apt 命令在同一层中完成。
|
||||||
|
否则,前面的层将会保持原有信息,而你的镜像则依旧臃肿。
|
||||||
|
|
||||||
```
|
```
|
||||||
RUN apt-get clean
|
RUN {apt commands} \
|
||||||
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
```
|
```
|
||||||
- 压缩镜像
|
- 压缩镜像
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue