liveBook · Manning

Root filesystem

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

A root filesystem is the filesystem tree presented as the top-level directory hierarchy to an operating-system environment or container.

A root filesystem, or rootfs, is the directory tree presented as the container’s Linux root (/). A container image packages this tree with JSON metadata and a manifest list. section 1.2.3

Podman unpacks the image, combines its metadata with runtime defaults and user input, and builds an OCI specification. The OCI runtime mounts volumes, switches / to the rootfs, and launches the image command. section 1.2.3 section 6.2.5

Rootfs isolation establishes the container’s filesystem boundary:

  • The mount namespace hides the host filesystem and exposes only content assigned to the container. section 10.7
  • Podman bind-mounts volumes onto the rootfs before pivot_root changes the namespace’s root mount. section 6.2.5 section 10.7
  • Dropping CAP_SYS_ADMIN limits processes’ ability to alter mounts, while SELinux adds protection against filesystem escape. section 10.7

Inspecting image rootfs metadata

Run podman inspect on an image to examine its command, environment variables, labels, architecture, and operating system metadata. section 1.2.3

$ podman inspect docker:/ /registry.access.redhat.com/ubi8
{
...
  "created": "2022-01-27T16:00:30.397689Z",      #1
  "architecture": "amd64",                       #2
  "os": "linux",                                 #3
  "config": {
         "Env": [                                #4
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
            "container=oci"
         ],
         "Cmd": [                                #5
                   "/bin/bash"
         ],
         "Labels": {                             #6
                     "architecture": "x86_64",
                     "build-date": "2022-01-27T15:59:52.415605",
       ...
}

Inspect representative image metadata, including Cmd, Env, Labels, architecture, and operating system fields. section 1.2.3

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

How deep it goes
Traces rootfs from image packaging through mounts and pivot_root, while deferring detailed pivot_root syscall behavior.
Examples
Uses podman inspect output and a detached podman run command to ground image metadata and runtime mounting.
What you can do after
Evaluate/understand how image files become a container filesystem and how Linux mechanisms restrict host visibility.
How it connects
Connects rootfs with container images, OCI runtimes, mount namespaces, volumes, capabilities, and SELinux.

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.