Filesystem changesets, whiteouts and copy-on-write
Worked example
This is an offline lesson. Data are fictional and Docker commands are unexecuted. Any optional execution requires an authorized disposable VM, a verified context, synthetic data, restricted access and no external transmission. Do not collect secrets or private output. Treat the worksheet as offline evidence. Before any separately authorized server query, verify the effective endpoint and its trust boundary, including context overrides. Do not change runtime state, mount host data or modify Desktop settings in this exercise.
Synthetic flat-file layers (not real tar archives):L1: app.txt=old, note.txt=keep, retired.txt=obsoleteL2: app.txt=new, .wh.retired.txt (whiteout)Merged: app.txt=new, note.txt=keepContainer writable view: app.txt=edited (only this container)Original L1 remains unchanged.Apply L1 then L2. The newer app.txt replaces the older path in the merged view and the OCI whiteout hides retired.txt from earlier layers. It does not erase the earlier layer blob. OCI also defines an opaque whiteout marker for hiding lower directory entries; the simple flat-file model intentionally excludes directory trees. OverlayFS may copy up a lower file when modified and write to the upper layer. The underlying filesystem’s native whiteout representation need not match OCI tar encoding. A new container from the unchanged image starts with app.txt=new, not edited. A mounted volume is a separate persistence mechanism. Never bake secrets into an earlier layer assuming a later deletion removes them from image history. An OCI whiteout hides paths from earlier layers, not a same-layer replacement. The local dictionary uses None for a deletion marker and deliberately cannot model same-layer duplicate entries, directories or tar ordering. L3 may restore retired.txt without modifying L1.
Common mistake
Hiding a path in the merged view is not secure erasure of the image blob.
Manual practice
Run the offline flat-layer tests. Predict the merged view if a third layer adds retired.txt again; explain why L1 has not changed.
Worksheet: lab-fixtures/docker-container-internals/08-filesystem-layers/scenario.txt.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Filesystem changesets, whiteouts and copy-on-write — Knowledge check
Interpret synthetic runtime and isolation evidence and explain kernel and OCI boundaries.
In the fictional merged filesystem immediately after applying L2, which ordinary files and values are visible?
Does the whiteout erase the earlier blob?
What does a fresh container see for app.txt before any new writes?