6 ms·
Docker storage engines remember all the layers by storing incremental differences so it makes little sense to have a layer that only removes things (like the la
by tmd 11y ago
Docker storage engines remember all the layers by storing incremental differences so it makes little sense to have a layer that only removes things (like the last RUN in https://github.com/iron-io/dockers/blob/master/ruby/Dockerfile https://github.com/iron-io/dockers/blob/master/ruby/Dockerfi...). You can see with `docker history <image>` that this layer has 0 bytes and you can access anything that it removes by using the parent image (`docker run -it 88ae7e32865f ls /var/cache/apk`).
In this case it doesn't make much difference (a couple of MB perhaps) but often you'll see people chaining all the commands and ending it with a cleanup in a single RUN like here: https://github.com/docker-library/ruby/blob/ccbf9e54f60ba2455f4f18e223c5745a14657bdb/2.0/Dockerfile https://github.com/docker-library/ruby/blob/ccbf9e54f60ba245...
- grkvlt 11y agoHeh, looks like the author fixed this [1] and it now uses the technique you suggest, based on issue #22 [2] which restates the same thing as your comment, basically chaining everything together with `&&` in a single `RUN` entry. [1] https://github.com/iron-io/dockers/commit/71687edb849dcb9079572f1de251106f6e666ed9 https://github.com/iron-io/dockers/commit/71687edb849dcb9079... [2] https://github.com/iron-io/dockers/issues/22 https://github.com/iron-io/dockers/issues/22