You can use
dive to help you optimize your Docker image layers.
Say you have these two layers in your
RUN wget http://xcal1.vodafone.co.uk/10MB.zip -P /tmp RUN rm /tmp/10MB.zip
Then you’ll end up with
10MB of wasted space.
dive will tell you, so that you can combine these into one optimized layer:
RUN wget http://xcal1.vodafone.co.uk/10MB.zip -P /tmp && rm /tmp/10MB.zip
You can also integrate it as a build step in your CI/CD pipeline, and make it break the build in case you don’t meet a certain quotum.
Installation per Homebrew:
brew install dive
🔗 Related: In How to build smaller Docker images you can find some practical tips to keep your docker image size under control.