Container Isolation and Security Defaults
Cheat sheet · https://pcornel.dk/topic.php?topic=6122
Answer
Container isolation and security defaults: containers run with dropped capabilities, seccomp and AppArmor/SELinux profiles, but often as root inside. Hardening adds non-root users, read-only root filesystems, no privilege escalation and minimal capabilities.
Remember
Avoid --privileged, hostPath and host namespaces. Run as non-root (USER, runAsNonRoot), drop all capabilities and add back only needed ones, set allowPrivilegeEscalation: false and readOnlyRootFilesystem. Enforce with Pod Security Admission (restricted).
First checks
docker ps -a— containers and exit codesdocker logs <c>— container outputdocker inspect <c>— config, mounts, network, state
Verify in this order
image user → runtime defaults (caps, seccomp, LSM) → pod securityContext → admission policy
Where it usually breaks
Granting --privileged to fix one permission error opens the host.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6122