Interview Prep/Docker/Images, Layers & Storage Drivers

What is copy-on-write (CoW) in containers?

IntermediateConceptImages, Layers & Storage Drivers
Answer

When a container modifies a file that lives in a lower read-only layer, overlay2 first copies the whole file up to the upperdir, then modifies the copy. The first write to a large file is slow and costs space; later writes are normal. Deleting a lower file creates a whiteout (a char device 0/0) in upperdir. Heavy write workloads should use volumes.

All Docker questions Roadmap: Docker & containers

More on Images, Layers & Storage Drivers