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.
More on Security and scanning
A scan reports 300 CVEs in your base image. How do you triage?IntermediateAdd vulnerability scanning to CI so critical findings block the merge.BeginnerWhy is mounting `/var/run/docker.sock` into a container dangerous?IntermediateA developer asks for `--privileged`. What do you do?IntermediateHarden a container run command for a stateless web API.IntermediateA pentester got root inside a container. How bad is it?Advanced