Interview Prep/Docker/Security and scanning

Compliance wants evidence that containers do not run as root.

IntermediateScenarioSecurity and scanning
Answer

Situation read → Need automated audit.

What I'd do →

docker ps -q | xargs docker inspect -f '{{.Name}} user={{.Config.User}} priv={{.HostConfig.Privileged}}'

Build a CI check with hadolint rule DL3002, trivy config, and in Kubernetes enforce Pod Security Standards "restricted" or Kyverno policy require-run-as-nonroot. Run docker-bench-security for the host.

Why → Policy-as-code produces repeatable evidence.

Interview tip → CIS Docker Benchmark is the common reference.

All Docker questions Roadmap: Docker & containers

More on Security and scanning