No magic tricks. Just small, boring decisions that compound faster than you expect.
A while ago, I looked at one of my Docker images and paused.
2.3 GB.
For a service that barely did anything.
You know Docker. You know the best practices. You have read the blogs. And yet here you are, staring at an image size that explains exactly why your CI runner feels tired all the time.
Big images slow everything down, I did not fix this with some advanced optimization or a clever hack.
I just started cleaning.
First, the base image.
Nothing exotic. Just switching away from a full-fat base when a slim or alpine one was enough.
Then multi-stage builds.
Letting the build tools live and die in the build stage, instead of hitchhiking into production forever.
Then the uncomfortable part.
Actually removing things.
Debug tools I never used at runtime.
Package managers that had no business being there.
Utilities that felt harmless until you realize they add up.
Slowly, the image started shrinking.
2.3 GB became 395 MB.
A 83 % reduction.
That was the lesson that stuck with me.
Most bloated images are not the result of ignorance. They are the result of convenience. One extra tool here. One “just in case” package there. Nobody notices until the pipeline starts timing out and everyone blames the CI system.
Reducing image size is about, paying attention and asking, is this really needed?

