Cloud & app security

DevSecOps Container Security: Scan, Sign and Secure Images

Container security is decided before an image ships. Here is how DevSecOps teams scan, slim, sign and monitor containers across the whole pipeline.

Cysoro Security TeamPublished · 8 min read
app:1.4.2 sha256:9f2c…SCAN: PASSSIGNED ✓0 Critical · 0 High · SBOM attached Gate: approved Gate: blocked CLOUD & APP SECURITY Containersecurity Scan it. Sign it. Gate it.
Quick answer

DevSecOps container security embeds security checks into the container pipeline: scan images for known vulnerabilities in CI, use minimal base images, sign images, keep secrets out of layers, run containers as non-root, enforce admission policy in Kubernetes, and monitor runtime behavior continuously.

Key takeaways

  • Most container risk is decided at build time by the base image, the packages you include, and whether you run as root.
  • Scan in CI, rescan in the registry, and enforce admission control so unscanned or unsigned images never reach production.
  • NIST SP 800-190 organizes container security into five layers: image, registry, orchestrator, container runtime, and host operating system.

A container image ships with everything your application needs — and, usually, a lot it does not. Every extra package is a possible vulnerability, every secret baked into a layer is a leak waiting to happen, and every image that reaches production un scanned is a gamble.

What is DevSecOps container security?

DevSecOps container security means building security checks into the container pipeline itself, so vulnerable, unsigned or misconfigured images are stopped automatically before they reach production.

DevSecOps is DevOps with security as a shared, automated responsibility rather than a final review. For containers, that means the pipeline scans, signs and tests images, enforces policy at admission, and watches workloads at runtime.

The reference most teams start from is NIST Special Publication 800-190, the Application Container Security Guide, published in September 2017. It organizes container risk into five areas: images, registries, orchestrators, containers, and the host operating system. That structure still works because it stops a team from over-investing in image scanning while the registry, orchestrator or host stays weak.

A container shares the host kernel, so isolation is weaker than a virtual machine by design. That is why the controls are layered: a fix at the image layer, a gate at the registry, a policy at the orchestrator, and detection at runtime.

What are the five layers of container security?

NIST SP 800-190 groups container risk into five layers: the image, the registry, the orchestrator, the running container, and the host operating system. Each layer needs its own controls.

LayerMain risksCore controls
ImageKnown vulnerabilities, configuration defects, embedded secrets, untrusted sourcesScan in CI, minimal base images, signing, secret scanning
RegistryInsecure connections, stale images, weak authenticationTLS only, authenticated pulls, tag immutability, pruning
OrchestratorUnbounded admin access, flat networks, mixed sensitivity workloadsRBAC least privilege, network policies, Pod Security Admission
Container runtimeRuntime vulnerabilities, privilege escalation, rogue containersNon-root user, dropped capabilities, seccomp, runtime detection
Host OSLarge attack surface, shared kernel, file tamperingContainer-specific host OS, prompt patching, restricted access

Use this table as a checklist, not a menu. A team that scans images but lets any developer pull from a public registry with no authentication has fixed the visible risk and left the door open. XenonStack's container security guide maps the same five NIST areas to practical controls.

How does container image scanning work?

A scanner reads every layer of an image, lists the operating system packages and application dependencies it finds, and matches each version against vulnerability databases such as the National Vulnerability Database and distro security feeds.

Each finding usually names the affected package, the severity (Low, Medium, High or Critical), the installed version, and the fixed version if one exists. Scanners such as Trivy and Grype are widely used open-source options, and registries and commercial platforms add their own scanning too. Upwind's guide to image scanning explains where to scan and how to prioritize findings.

Scan in five places if you can: on developer machines, in CI before push, in the registry on a schedule, on shared base images, and on workloads already running in Kubernetes. The registry rescan matters because new vulnerabilities are disclosed after an image ships.

A first scan often returns hundreds of findings. Do not panic. Fix Critical and High findings with an available fix first, then ask whether the vulnerable package is actually loaded or reachable at runtime before spending days on the rest.

How do you secure containers in the CI/CD pipeline?

Put the scan after the build and before the push, fail the build on fixable Critical or High findings, generate an SBOM, sign the image, and push only if every gate passes.

The secure container pipeline1Buildminimal base,pinned digest2ScanCVEs, secrets,misconfig3Gatefail on Highor Critical4Sign + SBOMprove origin,list contents5Admitsigned imagesonly6MonitorruntimedetectionA scan you run by hand is a scan you will forget. Automate every gate.Rescan stored images daily: new CVEs appear after an image ships.
The six gates of a secure container pipeline, from build to runtime monitoring. Illustration by Cysoro.

The gate is the point. A scanner that only reports findings changes nothing; the pipeline must fail the build when a fixable Critical or High vulnerability appears, using the scanner exit code. Pin the scanner version too, so results are reproducible.

Pin base images by digest, not by a mutable tag such as latest. A tag can point at a different image tomorrow, while a digest always points at the same bytes.

Generate a software bill of materials (SBOM) at build time, in a format such as CycloneDX or SPDX, and store it with the image digest. When the next big vulnerability is announced, the SBOM tells you exactly which images contain the affected component.

Sign the image with a current tool such as Sigstore Cosign or Notary Project Notation. Docker Content Trust, the older signing approach, began being retired in August 2025, so new pipelines should not be built on it.

How do you slim down a container image?

Remove everything the application does not need: use a minimal or distroless base image, use multi-stage builds, and drop shells, package managers and build tools from the runtime stage.

Every file in an image is something that can carry a vulnerability or be misused by an attacker. A large general-purpose base image can ship with dozens of known vulnerabilities before your code even runs.

Multi-stage builds keep compilers and build tools in the build stage and copy only the compiled application into a small runtime stage. Distroless images go further by shipping no shell or package manager at all, which also makes them harder to explore if an attacker gets in.

Keep secrets out of images entirely. NIST recommends storing secrets outside images and providing them dynamically at runtime, through a secrets manager or the orchestrator. A secret in a layer stays in the image history even if a later layer deletes the file.

Never bake secrets into layersAPI keys, passwords and tokens do not belong in Dockerfiles, image layers, Git repositories or CI logs. Inject them at runtime and rotate them regularly.

How do you secure containers in Kubernetes?

Enforce admission policy so only signed, scanned images from approved registries can run, apply Pod Security Admission, restrict network traffic, and give every workload the least privilege it needs.

Admission control is the second gate. Even if an image somehow bypasses CI, the cluster should refuse to run it unless it is signed, scanned and from an approved registry. Tools in this space include Kubernetes admission controllers and policy engines.

Use the Pod Security Admission standards — Privileged, Baseline and Restricted — applied through namespace labels. Kubernetes removed the older PodSecurityPolicy in version 1.25, so teams still referencing it should migrate.

Apply RBAC with least privilege: service accounts should only have the permissions their workload actually needs. Add network policies that limit which pods can talk to each other and restrict egress, so a compromised container cannot freely reach the internet or internal services.

Never mount the Docker socket (/var/run/docker.sock) into a container, and never expose the container daemon on TCP without TLS. The socket effectively gives root on the host.

What runtime controls stop a container escape?

Run as non-root, drop all Linux capabilities you do not need, keep the default seccomp profile, use AppArmor or SELinux where available, and run the filesystem read-only.

Each control blocks a different escape route, so they work as a set. Drop all capabilities and add back only the specific ones the application needs. Set no-new-privileges so a process cannot gain more privilege by executing a setuid binary. Never run a container with --privileged in production.

Runtime detection is the last layer. Tools such as Falco watch system calls and flag behavior image scanning cannot see: a shell starting inside a container, writes to /etc, or namespace changes. Prevention will miss things, so detection and a practiced response matter.

Keep the host operating system container-specific and patched. A container-specific host OS has a smaller attack surface than a general-purpose server, and a shared kernel means a host vulnerability can affect every container on it.

What are the most common container security mistakes?

The most common mistakes are scanning without a gate, running as root, using the latest tag, baking secrets into images, and ignoring runtime security entirely.

Five mistakes — and the fix for eachScan but never blockFix: fail the build on High / CriticalRunning as rootFix: non-root USER, drop capabilitiesUsing the latest tagFix: pin by digest sha256:…Secrets baked into layersFix: inject at runtime onlyNo runtime detectionFix: syscall monitoring + alerts
Common container security mistakes and the fix for each. Illustration by Cysoro.
  • Scanning without a gate. Reports that nobody must act on are decoration. The build must fail.
  • Running as root. The default user in many images is root. Set a non-root USER in the Dockerfile.
  • Trusting tags. Tags move. Digests and signatures do not.
  • Secrets in layers. Deleting a secret in a later layer does not remove it from the image history.
  • Ignoring the registry. Old, unscanned images get deployed in emergencies. Prune them and rescan what remains.
  • No runtime monitoring. Image scanning cannot see an attacker who logs in with a stolen credential.

Start small if you are starting from scratch: scan in CI with a failing gate, switch to a minimal base image, and run as non-root. Those three changes remove most of the common risk before you buy any platform.

What should a DevSecOps container checklist include?

A practical checklist covers the image, the pipeline, the registry, the cluster and runtime: scan, slim, sign, gate, restrict, monitor and rescan on a schedule.

  1. Build: minimal base image, pinned digest, multi-stage build, non-root user, no secrets in layers.
  2. Scan: image, dependencies and Dockerfile in CI; fail on fixable High or Critical findings.
  3. Record: generate and store an SBOM with every image digest.
  4. Sign: sign images and verify signatures at admission.
  5. Registry: private registry, TLS, strong authentication, tag immutability, pruning and rescanning.
  6. Cluster: RBAC least privilege, Pod Security Admission, network policies, no privileged containers.
  7. Runtime: dropped capabilities, seccomp, read-only filesystem, runtime detection and alerts.
  8. Host: container-specific host OS, prompt patching, restricted access.

Review the checklist after every incident and every new vulnerability disclosure. Container security is a pipeline discipline, not a one-time hardening project.

For a wider starting point, our small business cybersecurity checklist covers backups, updates and device security alongside these pipeline controls.

You can also check your headers with the free security headers checker.

The bottom line

DevSecOps container security is not one tool. It is a chain of small, automated decisions: a minimal image, a scan that can fail the build, a signature that proves origin, an admission gate that enforces both, and runtime detection for what slips through.

Start with the three highest-leverage changes — scan with a failing gate, slim the image, and stop running as root — then add signing, SBOMs and runtime monitoring.

You can check the public face of your own services in seconds with the free SSL checker.

Frequently asked questions

What is DevSecOps container security?

It is the practice of building security into every stage of the container lifecycle, from the Dockerfile and CI pipeline through the registry, Kubernetes admission, and runtime monitoring, instead of checking security only after deployment.

What is the difference between DevOps and DevSecOps for containers?

DevOps automates building and shipping containers. DevSecOps adds automated security gates to that same pipeline, such as image scanning, signing, and policy checks, so a vulnerable image fails the build instead of reaching production.

How often should container images be scanned?

Scan on every build in CI, scan on push to the registry, and rescan stored images on a schedule, because new vulnerabilities are disclosed every day and an image that was clean last month may not be clean today.

Should containers run as root?

No. Containers should run as a non-root user with dropped capabilities and a read-only filesystem where possible, so that if an attacker escapes the application, they gain far less power on the host.

What is an SBOM and why does it matter for containers?

A software bill of materials is a list of every component inside an image. It lets you find every image affected by a new vulnerability quickly, instead of guessing which services use a vulnerable library.

What is image signing in container security?

Image signing attaches a cryptographic signature to an image so a cluster can verify who built it and that it has not been changed. Admission control can then refuse to run unsigned images.

Does image scanning catch everything?

No. Scanning finds known vulnerabilities, secrets, and misconfigurations in image contents. It does not catch zero-day flaws, abused credentials, insecure cluster configuration, or attacks that happen at runtime, so runtime detection is also needed.

Sources

  1. NIST — SP 800-190, Application Container Security Guide (via Anchore summary)
  2. Upwind — Container Image Scanning: How It Works and Best Practices
  3. XenonStack — Container Security: Best Practices and NIST SP 800-190
  4. Encryption Consulting — How Do You Secure a Container?
  5. WPSauce — Container Security Solutions Every DevOps Team Should Consider
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against NIST SP 800-190 and current container image scanning guidance from Upwind and XenonStack.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free