Capabilities, rootless and overlay filesystems
Quick answer
Rootless containers use an ordinary host user and usually user-namespace ID mappings. Overlay filesystems can combine read-only image layers with a writable upper layer. These mechanisms reduce some risks and storage duplication but do not guarantee isolation or persistent application data.
Root inside a user namespace need not be root on the host. A write to a file from a lower image layer may create a copy in the writable layer. Separate persistent application data from that layer so replacement of the container does not unexpectedly discard it.
Prepare the practice environment
Run python3 lab-fixtures/containers-virtualization/setup.py from the extracted root as an ordinary user. Enter the printed private path and check pwd. Use fresh fixtures, Bash with set -e -o pipefail, LC_ALL=C and umask 077. The Python helper parses fictional examples or inspects its own child. No runtime daemon, external network or root access is needed. Do not apply the fictional JSON to any runtime. Version checks need the named tools.
Prerequisites
Review: Cgroups v2 and resource accounting.
How it works
Capabilities split privileged operations; effective, permitted and bounding sets affect what a process may do. In a user namespace capabilities are scoped to resources governed by that namespace; a rootless runtime is not a host-root daemon. Kernel and distribution support, subordinate ID ranges, storage and networking helpers affect rootless behavior. OverlayFS presents a merged view of lower and upper directories. When a lower file needs modification, copy-up creates an upper representation; deletions can be represented by whiteouts. Metadata-only copy-up and other features complicate this model. Container writable layers are tied to container lifecycle, so keep important data in deliberately managed persistent storage with backups. A bind mount exposes a host path and can bypass the expected separation of image storage. Do not assume a rootless runtime eliminates risks to the invoking user’s files.
Try the examples
grep -Eq '^CapEff:[[:space:]]+[[:xdigit:]]+$' /proc/$$/status && printf 'effective capability field present\n'This only checks the field format, not a security verdict or capability grant.
Expected stdout:
effective capability field presenttest -n "$(findmnt -n -o FSTYPE -T .)" && printf 'filesystem type reported\n'Read-only mount inspection; the actual type varies.
Expected stdout:
filesystem type reportedAn ordinary Python dictionary illustrates an upper-layer override; no OverlayFS mount is created.
Expected stdout:
before: lower=base merged=baseafter: lower=base merged=editedCommon mistakes
Never use privileged containers, broad host bind mounts or runtime socket mounts just to make a sample work. Do not store important data only in a disposable writable layer.
Practice
Extend the overlay dictionary model with a second file. Predict the merged view before and after the first file is overridden. Explain why this is not a filesystem implementation.
Related references
Study: findmnt. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Capabilities, rootless and overlay filesystems — Knowledge Check
Apply container and virtualization concepts to concrete local examples.
What does rootless execution reduce?
What is copy-up in the simple overlay model?
What should hold durable application data?
Does reading CapEff prove secure isolation?