Skip to content

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

  1. Use multi-stage builds and copy only what runs
  2. Clean package manager caches in the same RUN that populates them
  3. Choose a slim or distroless base
  4. 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.