The Exploded Cluster · Course I

An image is not a box.
It is a stack of frozen diffs.

Scroll, and the thing you keep calling "a container image" comes apart in your hands. Four layers. Each one only stores what changed from the layer under it.

Docker image layers, exploded

An exploded isometric view of a container image: four stacked slabs floating apart —
                  a heavy metal base, a circuit-etched dependency layer, a magenta-traced code layer,
                  and a thin frosted-glass writable layer on top.

    Field note. The order of your Dockerfile is a caching decision, not a style choice. Put COPY . . above your dependency install and you have told the builder to throw away every cached layer every time you change one line of code.