Update dockerfile_best-practices.md (#1672)

* Update dockerfile_best-practices.md
This commit is contained in:
scjane 2017-02-23 02:55:28 +08:00 committed by Misty Stanley-Jones
parent 4576e1a6b7
commit dbe18ae730
1 changed files with 4 additions and 4 deletions

View File

@ -275,10 +275,10 @@ used an older version, specifying the new one causes a cache bust of `apt-get
update` and ensure the installation of the new version. Listing packages on
each line can also prevent mistakes in package duplication.
In addition, cleaning up the apt cache and removing `/var/lib/apt/lists` helps
keep the image size down. Since the `RUN` statement starts with
`apt-get update`, the package cache will always be refreshed prior to
`apt-get install`.
In addition, when you clean up the apt cache by removing `/var/lib/apt/lists`
reduces the image size, since the apt cache is not stored in a layer. Since the
`RUN` statement starts with `apt-get update`, the package cache will always be
refreshed prior to `apt-get install`.
> **Note**: The official Debian and Ubuntu images [automatically run `apt-get clean`](https://github.com/docker/docker/blob/03e2923e42446dbb830c654d0eec323a0b4ef02a/contrib/mkimage/debootstrap#L82-L105),
> so explicit invocation is not required.