How Layers Work (The Transparent Sheet Analogy)

LEVEL 0

The Problem

You have two images:

  • python:3.11 — 1.01 GB
  • myapp built FROM python:3.11 — also shows 1.01 GB

Did Docker really store 2 GB? No — it stored about 1.01 GB. But how?

And when you run 10 containers from myapp, are there 10 copies of that 1.01 GB? No — still about 1.01 GB. How does that work?

The answer is layers.