Closed shift closed 8 years ago
Impressive @shift, not something I had thought about.
Nice, tested this out on the node image and it dropped it a good 5-6 MB. https://github.com/iron-io/dockers/blob/master/node/Dockerfile
Happy to help :)
Was about to post this as well while looking at the java image. BTW this is a general rule: you just never do cleanup of temporary files in a RUN by itself, always chain it to the RUN that brought in the files in the first place. Cheers
The following changes for the ruy container provide a 8.00% improvement in size:
Becomes:
The output of the original image virtual size is
40.07 MB
while the inlined version is37.02 MB
, in-keeping with the README'sprovide the smallest possible images
, this is an improvement :)This is because the layers are overlaid on each previous layer, you're currently leaving the packages in the
apt
RUN line layers and then saying they don't exist in the last layer, so the data is still pulled down.In-lining the commands leaves you with only one additional layer on the base image with all of the cleanup occurring in it :).