Container runtime security protects containerized workloads throughout their lifecycle by enforcing isolation, restricting privileges, and detecting threats. Containers share the host kernel, making the runtime layer (the interface between the kernel and container processes) a critical attack surface: a single kernel exploit or misconfigured mount can escape every policy layered on top of it. Modern container security combines Linux kernel primitives (namespaces, cgroups, capabilities), mandatory access control systems (AppArmor, SELinux, BPF-LSM), and runtime monitoring tools to prevent escapes, privilege escalation, and lateral movement. Kubernetes' User Namespaces reaching General Availability in v1.36 finally maps a container's root UID to an unprivileged host user by default, closing a gap that repeated runc container-escape CVEs have exploited, so teams still need defense-in-depth from build to runtime: image signing, vulnerability scanning, and behavior-based detection layered on top of that kernel-level isolation.
What This Cheat Sheet Covers
This topic spans 15 focused tables and 90 indexed concepts, 89 flashcards. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
Table 1: User and Privilege Isolation
The most impactful container security wins come from running processes as non-root, both inside the container and on the host. These controls ensure that even a compromised container yields minimal host-level power to an attacker.
| Technique | Example | Description | |
|---|---|---|---|
podman run --rm alpine whoami | β’ Containers run as a non-root user on the host β’ Docker daemon runs without root privileges, eliminating root-level attack surface entirely. | ||
securityContext:Β runAsNonRoot: trueΒ runAsUser: 1000 | β’ Kubernetes security context that forces containers to run as a non-root user β’ the pod fails to start if the image uses UID 0. | ||
pod-security.kubernetes.io/enforce: restricted | β’ Namespace-level label enforced by the built-in Pod Security Admission controller β’ the Restricted profile requires everything else in this table (non-root, no privilege escalation, dropped capabilities) by default. | ||
hostUsers: false (Pod spec, GA in Kubernetes v1.36) | β’ Maps container root (UID 0) to an unprivileged host user β’ even after a breakout, the attacker has no host root access; ID-mapped mounts (Linux 5.12+) make this practical for stateful volumes by remapping ownership at mount time instead of a slow recursive chown. | ||
securityContext:Β allowPrivilegeEscalation: false | β’ Prevents processes from gaining more privileges than their parent via setuid/setgid binaries β’ blocks common privilege escalation vectors. | ||
docker run --security-opt=no-new-privileges nginx | β’ Prevents container processes from acquiring new privileges through setuid executables or file capabilities β’ enforces privilege boundaries at the OS level |