Guides
How to reduce container image size
Images are hundreds of megabytes and slow to pull in every job.
5 min read
Images are hundreds of megabytes and slow to pull in every job.
Why it happens
Build tooling, package caches and intermediate files are all shipping in the final image.
How to fix it
- Use multi-stage builds and copy only what runs
- Clean package manager caches in the same RUN that populates them
- Choose a slim or distroless base
- Check what is actually in the image with dive before guessing
Your next build could be twice as fast, at half the price
Start free. Migrating away is the same one line, and we publish that diff too.
Related
How to set up Docker layer cachingDocker builds take ten minutes because every layer rebuilds.How to optimise a Dockerfile for CISmall code changes trigger long rebuilds.How to use multi-stage Docker buildsImages are large and contain build tooling that should not ship.How to run concurrent Docker builds safelyParallel matrix legs contend and builds slow down or fail.