You secure containers without constant manual work by deciding the rules once and letting the pipeline and the cluster enforce them. Use small base images, run as a non-root user, scan at build time, and block non-compliant workloads at admission. People then review exceptions, not every deploy.
Why does container security turn into toil?
Most of the toil comes from doing the same judgment call per image, per team, per week. NIST SP 800-190 groups container risk into five areas: images, registries, orchestrators, containers at runtime, and the host operating system. A team that reviews each by hand will fall behind the first time it has forty services.
The fix is not more reviewers. It is fewer decisions that need a human.
A constructed example
Picture a team with 40 services built from a mix of full-size OS images. A new base image vulnerability is announced. Without automation, someone files forty tickets. With a standard small base, a rebuild job and a gate, one change to the base reference triggers forty rebuilds and forty scans, and the dashboard shows which ones still fail.
That is the whole idea. Make the common case boring.
Which controls give the most return?
Start with the ones that remove entire classes of work.
Small, shared base images. Fewer packages means fewer findings to triage. Pin the base by digest, not just a tag, so a rebuild changes only when you decide it should.
Non-root, read-only, no extra privileges. The OWASP Docker Security Cheat Sheet recommends running as an unprivileged user, dropping Linux capabilities you do not need, using a read-only root filesystem where the app allows it, and setting no-new-privileges. It also warns against mounting the Docker socket into a container, since that hands the container control of the host's runtime.
Admission rules in the cluster. Kubernetes Pod Security Standards define three profiles: Privileged, Baseline and Restricted. Pod Security Admission can enforce a profile per namespace, or run in audit or warn mode first so you see what would break. Warn mode for a week, then enforce, is a low-drama rollout.
Network rules that start closed. NetworkPolicy lets you limit which pods talk to which, but it only works if your network plugin enforces it. Creating the object without an enforcing plugin does nothing, which is a classic silent gap.
One scan gate, one exception path. Scan the image in CI, fail on the severities you have agreed on, and give developers a written way to request a time-boxed exception. Without the exception path, people route around the gate.
How do you handle findings without drowning?
Not every vulnerable package in an image can be reached by your code. Sort findings by whether the vulnerable code is reachable, whether a fix exists, and whether the component is internet-facing. Treat a finding in a build-only layer differently from one in the running image, and use multi-stage builds so compilers and test tools never ship.
Safeguard scans dependencies and produces SBOMs, and its reachability analysis helps separate findings the code can actually hit from noise. That is one input to the gate, not a replacement for the other controls above.
How to check or apply this
- List your base images and pin each by digest.
- Move to a minimal base where the app allows it, and use multi-stage builds.
- Set a non-root user, drop capabilities, and set no-new-privileges in your image or pod spec.
- Turn on Pod Security Admission in warn mode for one namespace, review the output, then enforce.
- Confirm your network plugin enforces NetworkPolicy, then add a default-deny policy per namespace.
- Add one CI scan gate with a written exception process and an expiry date on every exception.
- Schedule a base image rebuild so patches arrive without a ticket.
Quick check
Is scanning images enough to secure containers?
No. Scanning finds known vulnerable packages. It does not stop a container from running as root, mounting the host socket, or talking to every other pod. Pair scanning with runtime settings, admission rules and network limits.
Do Pod Security Standards replace NetworkPolicy?
No. Pod Security Standards restrict what a pod may request, such as privileged mode. NetworkPolicy restricts which connections a pod may make. They cover different gaps.
Sources
- NIST SP 800-190, Application Container Security Guide
- OWASP Docker Security Cheat Sheet
- Kubernetes Pod Security Standards
- Kubernetes Network Policies
Last reviewed: 18 October 2026.