← All notes

Isolate container users from the host with Linux user namespaces

Answer: Linux namespaces isolate running processes and limit their access to system resources. A user namespace can map a container user to a less-privileged user on the host.

Docker userns-remap

Docker remaps that user to a less-privileged user on the Docker host. Inside the namespace, those mapped UIDs still act as the normal 0-to-65536 range, yet they have no privileges on the host machine itself. If privilege escalation is attempted outside the namespace, that process runs as an unprivileged high-number UID on the host. With userns-remap, the Docker daemon still runs as root.

Kubernetes pods

Kubernetes shows how to configure a user namespace for pods. The container user is isolated from the host user. Root inside the container can correspond to a different, non-root user on the host. Skip the user namespace, and a root container can keep root privileges on the node after a breakout.

| namespace | user | |---|---| | Linux namespaces | Isolation for running processes, limiting access to system resources | | user namespace | Maps a container user, including root, to a host user | | userns-remap | Docker setting that remaps container UIDs | | UID range | Mapped UIDs that function as 0 to 65536 inside the namespace | | pods | Kubernetes can configure a user namespace for pods |

See

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Docker docs, Isolate containers with a user namespace; Kubernetes docs, Use a User Namespace With a Pod. Apache-2.0; CC-BY-4.0. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Docker docs, Isolate containers with a user namespace; Kubernetes docs, Use a User Namespace With a Pod. Apache-2.0; CC-BY-4.0.

Cite this

Permanent ID: iil:note:hh6tz99f

iinventedlight. 2026. "Isolate container users from the host with Linux user namespaces." iinventedlight Library, iil:note:hh6tz99f, version of 2026-11-19. https://iinventedlight.com/library/notes/linux-user-namespaces/. License: CC-BY-4.0.

@misc{iil_note_hh6tz99f,
  author = {{iinventedlight}},
  title = {{Isolate container users from the host with Linux user namespaces}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-19},
  url = {https://iinventedlight.com/library/notes/linux-user-namespaces/},
  note = {Permanent ID iil:note:hh6tz99f. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/linux-user-namespaces.md.