Container Security
Cheat sheet · https://pcornel.dk/topic.php?topic=5034
Answer
Container security protects images, registries and running containers: minimal and scanned images, no secrets in images, non-root and rootless containers, dropped capabilities, seccomp profiles and runtime monitoring.
Remember
- Containers share the host kernel; isolation is weaker than VMs.
- Running as root or privileged makes escapes easier.
- Images often carry known vulnerabilities and secrets.
First checks
trivy image <image>— image vulnerabilitiesdocker inspect <container> --format '{{.HostConfig.Privileged}} {{.Config.User}}'— privileged/userkubectl get pods -A -o jsonpath='{..securityContext}'— security contexts
Commands
docker inspect
Verify in this order
image build → scan/sign → admission → runtime controls
Where it usually breaks
First mismatch in platform/workload identity → desired configuration → management/control plane → runtime enforcement → telemetry → workload/resource outcome; preserve identity/policy/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5034