Week 11 - podman and the Rootless Model¶
11.1 Conceptual Core¶
podmanis a daemonless, drop-indockerreplacement. It runs containers as the calling user, with no long-running daemon. Eachpodman runis a fork-exec into aconmonsupervisor +runc/crun.- Rootless containers run as a non-root user on the host, with a user namespace mapping host-UID to UID 0 inside the container. The biggest single security win in the modern container ecosystem.
- Rootless is now mature: works with overlay (since kernel 5.11), works with networking via
slirp4netns(slow) orpasta(fast, kernel 6.0+).
11.2 Mechanical Detail¶
- Rootless storage:
~/.local/share/containers/storage/. Image and container state per-user. - Rootless networking:
slirp4netns-userspace TCP/IP stack; works everywhere, slow (~1 Gbps).pasta-newer, kernel-bypass via `vsock - like tricks; faster (~10 Gbps).subuid/subgidfiles (/etc/subuid,/etc/subgid) define the host UID range mapped into the user namespace. Default 65536 IDs per user.- `podman generate systemd - produce systemd unit files for rootless containers. The recommended path for "always-on" rootless services.
11.3 Lab-"Rootless Production"¶
- As a non-root user, install
podman. Configure/etc/subuid,/etc/subgid. - Run a multi-container app with
podman play kube(Kubernetes-YAML-as-podman-input). - Generate systemd units; install with - -user
. The service starts at user login and persists across reboots (withloginctl enable-linger`). - Compare
slirp4netnsvspastanetworking throughput withiperf3.
11.4 Hardening Drill¶
- Confirm rootless containers cannot escape: try mounting host paths, accessing host devices, inspecting host processes. Each should fail (or be remapped innocuously via the user namespace).
11.5 Production Readiness Slice¶
- Convert one production-ish workload from rootful Docker/
runcto rootlesspodman. Document the operational deltas (port-binding <1024 needsCAP_NET_BIND_SERVICEviasysctl net.ipv4.ip_unprivileged_port_start=80).