Back to feed
Dev.to
Dev.to
7/15/2026
The original headline is "How I Shrunk Our Docker Images from 1.2GB to 85MB Using Multi-Stage Builds"

The original headline is "How I Shrunk Our Docker Images from 1.2GB to 85MB Using Multi-Stage Builds"

Original: How I Shrunk Our Docker Images from 1.2GB to 85MB Using Multi-Stage Builds

Short summary

A practical walkthrough of shrinking a Python Docker image from 1.2GB to 85MB using multi-stage builds. The author progresses from a naive python:3.11 base through slim multi-stage to alpine multi-stage, with concrete Dockerfiles and size comparisons at each step. Also covers distroless images for compiled languages like Go, achieving ~14MB final images.

  • Naive python:3.11 base produces 1.18GB images due to build tools and large base image
  • Multi-stage with python:3.11-slim drops to 210MB; switching to alpine reaches ~85MB
  • Distroless images for Go produce ~14MB binaries with no shell or package manager

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more