Interview Prep/Docker/Volumes, storage and data

Explain how copy-on-write affects performance of a write-heavy container.

AdvancedScenarioVolumes, storage and data
Answer

Situation read → Writes to files from lower image layers trigger a copy-up to the writable layer; writes to the container layer go through overlayfs.

What I'd do → Put write-heavy paths (DB data, logs, queues, build caches) on volumes, which bypass the storage driver and give near-native I/O. Check driver with docker info | grep -i storage (expect overlay2 or the containerd snapshotter overlayfs).

Why → Copy-up of a large file (e.g., a 1 GB file touched by 1 byte) is expensive and repeated across containers.

Interview tip → "Data on volumes, code in layers."

All Docker questions Roadmap: Docker & containers

More on Volumes, storage and data