Evan Seabrook puts Docker images on a diet:
If you’ve ever worked with Docker, there’s likely been at least one time when it started taking up significant storage space on your computer. For example, some of your images took a long time to download in a CI/CD pipeline. Some common approaches to this problem are to:
– Swap out the base image for something lighter
– Reduce the number of
RUN
statements in your Dockerfile– Remove cached package manager artifacts as part of your Dockerfile
These steps, while helpful, can take up a significant amount of time and effort. Thankfully, there are open source tools that can automatically minify an existing Docker image. Enter docker-slim.
Looks like it can slim things down considerably. I haven’t tried this, but might give it a go and see how it works.