A container image security scanning workflow should do more than report a long list of CVEs. It should identify which findings matter, connect them to an owner, verify that remediation changes the image actually deployed, and make exceptions visible and temporary. This guide presents a repeatable process for Docker image security scanning in CI/CD, including provenance checks, SBOM generation, prioritization, remediation, policy gates, and post-deployment verification.
Overview
Container scanning is most useful when treated as a release control rather than a one-time security activity. A scanner can inspect operating-system packages, language dependencies, application files, configuration, and sometimes image metadata. The result is a set of findings that must be interpreted in the context of the image, the service, and the environment where it will run.
A practical workflow has five stages:
- Establish image identity: record the repository, tag, immutable digest, build commit, base image, and build pipeline.
- Generate evidence: scan the image and produce an SBOM in a format your tools can store and exchange, such as SPDX or CycloneDX.
- Prioritize findings: combine severity with exploitability, package reachability, runtime exposure, and remediation availability.
- Fix and verify: rebuild from an appropriate base image or update the affected dependency, then scan the newly built digest.
- Control release and operation: apply CI gates, registry policies, admission checks, and post-deployment monitoring according to the service's risk.
The goal is not to make every image appear risk-free. That is rarely a realistic release criterion. The goal is to ensure that important findings are acted on consistently, accepted risks have owners and expiry dates, and the artifact running in production is the artifact that was reviewed.
Image scanning also complements, rather than replaces, secure build practices. Review the Dockerfile, restrict build context, avoid unnecessary packages, use non-root execution where practical, and keep secrets out of image layers. For broader deployment controls, pair this process with your secrets workflow; the secrets management comparison provides related guidance.
What to track
Image provenance and identity
Start with a reliable inventory. For every released image, record the registry path, tag, digest, source commit, build run, base-image reference, build timestamp, and deployment environments. Tags are convenient labels, but a digest is the stronger identifier for comparing the scanned artifact with the deployed artifact.
Track how the image was produced as well as what it contains. If your platform supports signatures or build attestations, store them with the image and define how verification is performed. The exact implementation will vary by registry and deployment platform, but the control objective is stable: establish a traceable link between source, build, scan result, registry object, and runtime deployment.
Vulnerabilities and affected components
For each finding, retain the vulnerability identifier, affected package, installed version, fixed version if available, scanner timestamp, severity assessment, and the image digest. Also record whether the package is part of the operating-system layer, a production dependency, a development dependency accidentally copied into the image, or an application artifact.
Do not treat a package name as sufficient evidence of runtime risk. Determine whether the vulnerable code is reachable, whether the relevant feature is enabled, whether the service is network-accessible, and whether compensating controls reduce exposure. These details help separate urgent remediation from work that can be scheduled without allowing the backlog to become invisible.
SBOM coverage and freshness
An SBOM should be tied to an exact image digest, not only to a mutable tag. Track whether it includes both operating-system and application dependencies, which generator produced it, and when it was created. Compare SBOMs between image versions to identify added, removed, and upgraded components.
SBOMs are useful for answering questions after a new vulnerability is disclosed: Which images contain the affected component? Which of those images are deployed? Which production services are exposed? Keep the answer reproducible by retaining historical SBOMs and scan results rather than overwriting the latest record.
Exceptions, gates, and ownership
Track every policy exception with a finding, image digest or affected scope, business or technical rationale, owner, approval, compensating controls, and expiry date. An exception without an expiry date tends to become a permanent bypass. A useful dashboard shows open critical and high-priority findings, time since discovery, time since the available fix, exception age, and the environments in which affected images run.
Cadence and checkpoints
Run a scan during every image build, but do not rely on build-time scanning alone. Vulnerability data changes after an image is released, so rescan stored images on a recurring schedule. A monthly review is a practical minimum for many teams; higher-risk services may need more frequent checks. Adjust the interval to the sensitivity of the workload, the volume of image changes, and the speed at which new vulnerability information must reach operators.
At build time
- Build from an approved base-image source and record its digest.
- Scan the image before publishing it to the release repository.
- Generate an SBOM and attach it to the exact image digest.
- Run configuration checks for exposed secrets, unsafe permissions, unnecessary packages, and risky Dockerfile instructions.
- Apply a narrowly defined gate for findings that require immediate action.
Before promotion
Recheck the image after signing, promotion, or any transformation that could change its digest. Confirm that the deployment manifest references the reviewed digest rather than a floating tag. Verify that the exception list still covers the exact finding and artifact; an exception for one image version should not silently apply to every future build.
Monthly or quarterly review
Review the vulnerability backlog, stale exceptions, base-image age, SBOM generation failures, and scan coverage across repositories. Identify images that are no longer deployed and remove them from active release paths. Compare recurring results to find teams with repeated findings caused by a shared base image or common dependency.
For platform teams, this is also a useful checkpoint for registry retention, access controls, admission policies, and scanner integration. If infrastructure changes are part of the remediation, document the expected state and compare it with the deployed state, using a process similar to the Terraform and OpenTofu drift detection workflow.
How to interpret changes
A rising finding count does not always mean that security has deteriorated. The scanner may have added a vulnerability source, improved package detection, started inspecting a previously missed layer, or reclassified a finding. Conversely, a lower count does not prove that risk has been removed if the vulnerable component remains in a running image or if the deployment still references an older digest.
When results change, ask four questions:
- Did the artifact change? Compare the image digest and SBOM, not just the tag.
- Did the vulnerability data change? Check whether the identifier, severity, affected version range, or fix status was updated.
- Did exposure change? Determine whether the service, endpoint, privilege, or network path changed.
- Did the fix reach the workload? Confirm the deployed digest through the registry, deployment controller, or cluster inventory.
Prioritize findings using a documented decision model. Severity is a starting signal, not the complete decision. Increase priority when a finding has a usable exploit path, affects a public-facing service, runs with broad privileges, is reachable in production, or has an available fixed version. Lower urgency only with evidence, such as an unreachable code path or an image that is not deployed, and record that reasoning in the ticket.
When a fix is unavailable, reduce exposure where possible: remove the component, disable the affected feature, limit network access, reduce privileges, or move the workload to a safer base image. These measures do not erase the finding, so keep the original record and set a review date. Avoid suppressing a finding merely because it is noisy; first determine whether the scanner rule, package mapping, or image inventory needs correction.
Set CI gates around outcomes that can be evaluated consistently. For example, a pipeline might block a new image when it introduces an urgent finding without an approved exception, while allowing existing findings to proceed only if they remain within an agreed remediation window. The exact thresholds belong in version-controlled policy and should be tested like application code.
When to revisit
Revisit this workflow on a monthly or quarterly schedule and whenever the underlying inputs change. A scheduled review should confirm scan coverage, newly disclosed vulnerabilities, open exceptions, base-image updates, SBOM freshness, and whether production still runs the digests that passed review.
Trigger an immediate review after a critical vulnerability disclosure, a change to a base image, a major scanner or vulnerability-database update, a registry migration, a new Kubernetes admission control, or a change in the service's exposure or privilege. Also revisit the process after an incident or audit finding. The question is not only whether the scanner detected the issue, but whether the organization could identify affected images, assign an owner, deploy a fix, and prove that the fix reached production.
Use this short checkpoint before each image release:
- Is the image identified by an immutable digest and traceable to a build?
- Was the exact digest scanned and given an SBOM?
- Were findings prioritized using severity, exploitability, reachability, and exposure?
- Do urgent findings have a verified fix or a documented, time-limited exception?
- Does the deployment reference the reviewed digest?
- Will the image be rescanned after release as vulnerability data changes?
Keep the checklist and policy close to the pipeline, update it when tools or platform controls change, and review the evidence rather than relying on a green build alone. That combination makes container image vulnerability scanning a maintainable security practice instead of a report that is quickly forgotten.