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."
More on Volumes, storage and data
A Postgres container was removed and the data is gone. How should it have been run?BeginnerBind mount or named volume for local development of a Node app?BeginnerHow do you back up a named volume?IntermediateTwo containers must share files. What are your options?BeginnerA container needs a writable temp area but the root filesystem is read-only.IntermediateMoving a database volume from one Docker host to another.Intermediate