Skip to main content

What does Docker’s copy-on-write mechanism do?

Junior Docker
Quick Answer Copy-on-write means containers share read-only image layers until they need to modify a file. When a container writes to a file from an image layer, Docker copies that file into the container's writable layer first Ò€” then modifies the copy. The original image layer stays unchanged, shared by all containers.

Answer

It avoids duplicating data. If many containers use the same layer, Docker creates a new copy only when modification occursβ€”saving disk space.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice