Rootless Docker and filesystem ownership
File permissions depend on numeric user and group IDs (UID/GID), not merely displayed names. User namespaces can translate those IDs between a container and the host. A process that sees itself as UID 0 inside a rootless container does not thereby become host root. This matters when mounting files whose host ownership is different.
Worked storage scenario
Use the synthetic scenario offline first. No real data, daemon changes, host mounts or production resources are required. Commands, if shown, are documented examples rather than observed output. Any real Docker check requires an approved disposable context. Keep the exercise offline. For any separately authorized Docker verification, identify the effective endpoint (including DOCKER_HOST and DOCKER_CONTEXT) before sending even read-only Engine requests. Record server version and platform; redact sensitive metadata.
Hypothetical user namespace mapping (inside, outside, count)0 1000 11 200000 65536File X: host UID 200004, owner-write onlyProcess A: inside UID 5Process B: inside UID 6A mapping row translates an inside ID by its offset from the row start. In this example, inside UID 5 maps to host UID 200004; UID 6 maps to 200005. A matches the owner of X; B does not. Assume no other access grants, no override capabilities and searchable parent directories for this example. In a real system, group membership, mode bits, ACLs, mount flags, security labels and filesystem behavior also matter. Rootless runs daemon and containers without host-root privileges; userns-remap instead leaves the daemon rootful. The two configurations can have different mappings. Check the actual mapping and intended service identity before changing ownership. Use a dedicated approved lab path or volume and a narrowly scoped ownership plan; never recursively change a shared host directory to solve a container error. A row applies only within its stated count; do not extrapolate an unmapped ID. UID 0 maps to 1000 here. Matching the owner is only one part of the actual authorization decision.
Common mistake
The same UID text on two sides of a namespace is not proof of the same identity. Do not use chmod 777 or disable security labeling as a generic repair.
Manual practice
Translate inside UIDs 0, 5 and 6. Explain which process matches X’s owner and list two other permission checks before proposing a correction.
Worksheet: lab-fixtures/docker-storage-engineering/05-uid-mapping/scenario.txt.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Rootless Docker and filesystem ownership — Knowledge check
Reason about storage behavior and recovery evidence.
What is the mapped host UID for inside UID 5?
Does rootless container UID 0 automatically equal host UID 0?
What differs between rootless and userns-remap?