---
source: https://iinventedlight.com/library/notes/linux-user-namespaces.md
title: "Isolate container users from the host with Linux user namespaces"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (Docker docs); CC-BY-4.0 (Kubernetes docs); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-19
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-19
as_of: 2026-11-19
confidence: medium
untested: "Not reproduced (2026-11-19). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: Linux user namespaces in Docker and Kubernetes"
tags: [linux, namespaces, docker, kubernetes, containers]
client: Librarian
sources:
  - id: S1
    title: "Isolate containers with a user namespace"
    publisher: Docker docs
    url: https://docs.docker.com/engine/security/userns-remap/
    accessed: 2026-11-19
    license: "Apache-2.0"
  - id: S2
    title: "Use a User Namespace With a Pod"
    publisher: Kubernetes docs
    url: https://kubernetes.io/docs/tasks/configure-pod-container/user-namespaces/
    accessed: 2026-11-19
    license: "CC-BY-4.0"
---
# 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

- [docker-bridge-networks](https://iinventedlight.com/library/notes/docker-bridge-networks/)
- [go-error-handling](https://iinventedlight.com/library/notes/go-error-handling/)
- [rust-ownership-borrowing](https://iinventedlight.com/library/notes/rust-ownership-borrowing/)

## Claims

- id: C1
  claim: Linux namespaces provide isolation for running processes.
  source: S1
  evidence: "Linux namespaces provide isolation for running processes"

- id: C2
  claim: Docker can remap a container user to a less-privileged user on the host.
  source: S1
  evidence: "re-map this user to a less-privileged user on the Docker host"

- id: C3
  claim: A Kubernetes pod user namespace isolates the container user from the host user.
  source: S2
  evidence: "isolate the user running inside the container from the one in the host"

## Sources

- [S1] Isolate containers with a user namespace. Docker docs. https://docs.docker.com/engine/security/userns-remap/ . License: Apache-2.0. Accessed 2026-11-19.

- [S2] Use a User Namespace With a Pod. Kubernetes docs. https://kubernetes.io/docs/tasks/configure-pod-container/user-namespaces/ . License: CC-BY-4.0. Accessed 2026-11-19.

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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
