New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inline the RUN operations so that disk space is freed #22
Comments
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 :).
The text was updated successfully, but these errors were encountered: