liveBook · Manning

Rootless mode

As explained in Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more

A rootless container is a container whose engine and processes run without host-level root privileges.

Rootless mode runs the container engine and its processes without host-level root privileges. Podman lets ordinary users run containers and build images using a standard Linux account, while processes remain owned by that user. section 1.3.2 section 1.1

User namespaces provide the foundation. Podman maps multiple subordinate UIDs and GIDs to a user, isolating container processes from host users and from containers belonging to other users. Each rootless user normally shares one user namespace across their containers. section 1.3.12 section 6.2

A rootless container startup involves several unprivileged components:

  • Podman reads the user's ranges from /etc/subuid and /etc/subgid and uses newuidmap and newgidmap to verify the allocation. section 5.4
  • A podman pause process keeps the user and mount namespaces alive so later Podman commands can join them. section 6.2
  • Podman creates container storage with overlay mounts or fuse-overlayfs on older kernels. section 6.2.2
  • slirp4netns supplies user-mode networking because unprivileged processes cannot create network devices or modify firewall rules. section 6.2.3
  • Podman starts the container process under the user's identity and monitors it with conmon. section 1.3.2 section 6.3

Run a rootless application

podman run -d -p 8080:8080 --name myapp quay.io/rhatdan/myimage The command pulls the image if necessary, creates rootless namespaces and storage, configures user-mode networking, and starts the application without host root privileges. If subordinate-ID files change, run podman system migrate so the pause process uses the new mappings. section 6.1 section 6.2

Rootless mode reduces the impact of container escape: a compromised process retains the invoking user's UID and ordinary-user capabilities rather than gaining host root. It is suited to shared, security-sensitive systems, although advanced networking and workloads requiring additional capabilities may require rootful execution or explicit configuration. section 6.0 section 6.2.3 section 8.4.2

How Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more covers it

How deep it goes
Descends from security motivation through user namespaces, subordinate-ID mappings, storage, networking, pause, and monitoring processes.
Examples
Demonstrates rootless application startup, port mapping, subordinate-ID configuration, pause-process inspection, and Podman inside Kubernetes or another container.
What it assumes
Assumes Linux process and permission basics while teaching user namespaces, subordinate UID/GID ranges, and rootless networking mechanisms.
What you can do after
Operate/configure Podman containers as an unprivileged user, inspect their namespace support, and recognize networking, UID, and capability constraints.
How it connects
Connects user namespaces, mount namespaces, subordinate IDs, slirp4netns, overlayfs, fuse-overlayfs, conmon, capabilities, and Kubernetes.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more. The section links point to the parts of the book it draws on.