Container image scanning is the automated inspection of a container image’s contents to identify known vulnerabilities, embedded secrets, license issues and insecure configuration before the image runs in production. In Containers practice within the Cloud field, it is also called container vulnerability scanning, and it is one of the main controls for software supply chain security.
A scanner does not execute the image. It reads the image layers and metadata, builds an inventory of operating system packages and application libraries, and compares that inventory with vulnerability databases that map package versions to published CVE identifiers. The result is a report of findings ranked by severity, which pipelines and registries use to block, warn or approve an image.
How container image scanning works
A container image is a stack of filesystem layers plus a configuration file, packaged according to the Open Container Initiative image specification. The scanner unpacks these layers, reads package manager databases such as those of dpkg, rpm or apk, and parses language manifests and lock files for ecosystems such as npm, PyPI, Maven, Go modules and RubyGems.
From this material the scanner builds a software bill of materials (SBOM), often in the SPDX or CycloneDX format. It then matches each component and version against vulnerability feeds, including the National Vulnerability Database, distribution security trackers and language advisory databases, and attaches CVSS severity scores and fix versions where they exist.
The table below shows what a scanner typically examines and which kind of problem each source reveals.
| Image content | Example | Finding type |
|---|---|---|
| OS package database | dpkg status, rpm database | Vulnerable system libraries |
| Language dependencies | package-lock.json, requirements.txt | Vulnerable application libraries |
| Static binaries | Go or Rust executables | Embedded vulnerable modules |
| Image configuration | User, exposed ports, environment | Running as root, risky defaults |
| File contents | Configuration files, keys | Exposed secrets and credentials |
Where scanning fits in the container lifecycle
Scanning is most effective when it runs at several points in the lifecycle, because new vulnerabilities are disclosed every day for images that were clean when they were built. A single scan at build time therefore gives only a snapshot of known risk, not a lasting guarantee.
The following table compares the main scanning stages and their purpose.
| Stage | Trigger | Main benefit | Limitation |
|---|---|---|---|
| Developer workstation | Manual or IDE plugin | Fastest feedback | Easy to skip |
| CI pipeline | Every build | Blocks vulnerable images early | Only covers new builds |
| Container registry | Push and periodic rescan | Catches newly disclosed CVEs | Does not stop running workloads |
| Admission control | Deployment to a cluster | Enforces policy before runtime | Needs reliable scan results |
| Runtime | Running containers | Shows what is actually deployed | Findings arrive after exposure |
Most registries, including Docker Hub and the major cloud registries, offer built-in scanning, and open-source scanners such as Trivy and Grype are commonly added to CI pipelines. In Kubernetes, an admission controller can reject images that lack a recent passing scan or a valid signature.
Interpreting and prioritizing scan results
A typical image built on a full distribution base can produce dozens to hundreds of findings, and treating them all as equally urgent quickly leads to alert fatigue. Effective triage combines severity with exploitability and reachability, asking whether the vulnerable code is present, loaded and exposed in this workload.
Useful signals include the Known Exploited Vulnerabilities catalog, exploit prediction scores such as EPSS, and VEX statements, which let a vendor or team record that a vulnerability does not affect a given product. The decision table below shows a common way to turn findings into actions.
| Finding | Recommended action | Reason |
|---|---|---|
| Critical, fix available, exploited in the wild | Block the build and patch now | Highest real-world risk |
| High, fix available | Fix within a defined service level | Cheap to resolve, meaningful risk |
| High, no fix available | Document, mitigate, monitor | Blocking would stop all releases |
| Component not reachable at runtime | Record a VEX not-affected status | Reduces noise without hiding risk |
| Low or informational | Fix during regular base image updates | Little benefit from urgent work |
Reducing findings at the source
The most durable way to improve scan results is to ship less software. Every package in an image is a potential finding, so smaller images mean fewer vulnerabilities to track and a smaller attack surface at runtime.
- Start from a minimal or distroless base image that contains only the runtime the application needs.
- Use a multi-stage build so compilers, package managers and build tools stay out of the final image.
- Rebuild images regularly from updated base images instead of patching running containers.
- Pin base images by digest and update them deliberately, so scan results stay reproducible.
- Keep secrets out of the Dockerfile and build context, because deleted files remain in earlier layers.
Limitations of container image scanning
Image scanning finds known issues in recognizable components. It does not discover new vulnerabilities in custom code, and it does not observe how the container behaves once it runs.
The table below lists frequent blind spots and the complementary control that covers each one.
| Blind spot | Cause | Complementary control |
|---|---|---|
| False negatives | Software copied in without package metadata | SBOM generated at build time |
| False positives | Backported fixes not reflected in version numbers | Distribution-aware matching and VEX |
| Zero-day vulnerabilities | Not yet in any database | Runtime detection and least privilege |
| Flaws in custom code | No public advisory exists | Static and dynamic application testing |
| Tampered images | Scan result not tied to the deployed image | Image signing and digest pinning |
Understanding it simply
A container image is like a sealed moving box that holds a program and everything it needs to run. Container image scanning is opening the packing list and checking every item against a recall list before the box is shipped.
If a part inside is known to be faulty, the scanner flags it and usually says which newer version fixes it. Because new recalls are announced all the time, the boxes already in storage need to be checked again regularly, not only once when they were packed.
Applied in practice
A fintech development team builds about thirty microservice images a day and deploys them to Kubernetes. The first scan of its Node.js images, built on a full Debian base, reports more than 400 findings, most of them in system packages the services never use. The team moves to a multi-stage build with a slim base image, and the count falls to about 40 findings, of which six are high severity with fixes available.
The team then sets a policy: the CI pipeline fails on critical vulnerabilities with a fix, the registry rescans every image nightly, and an admission controller rejects images without a passing scan from the last seven days. When a widely exploited library flaw is published months later, the nightly rescan identifies the three affected services within hours, and patched images are rebuilt and deployed the same day.