Comparison
Image layervsOverlay filesystem
Image layer
changing one line at the top of the build file invalidates every layer beneath it and the build goes from nine seconds to four minutes.
One filesystem diff produced by a single build step, content-addressed and stacked with the others to form the image. Layers are shared and cached across images, which is what makes pulling a new build of the same service cheap. The whole practical skill of writing a build file is ordering steps so the slow, rarely-changing ones sit underneath the fast, always-changing ones.
Full entry →Overlay filesystem
the container writes a file and it lands in a thin writable layer on top, leaving the image underneath untouched.
The union mount that stacks read-only image layers and one writable layer into a single filesystem. It is why starting a container does not copy the image, and why a container that writes heavily to its own filesystem gets slow copy-on-write behaviour for files that came from a layer. Anything written there dies with the container, which is the mechanism behind logs and uploads mysteriously vanishing on restart.
Full entry →