Your team added a container image scanner to CI. The first run came back with 600 vulnerabilities on an image nobody thought was risky. Builds started failing for CVEs in packages the service never loads. Developers learned to add --exit-code 0, and the scanner went from guardrail to background noise in about a fortnight.
Container image scanning is mature, fast, and mostly free. What fails is the policy: what you scan for, where you block, and how you turn hundreds of findings into a short list that a human will actually fix. In this blog post, we will cover getting that policy right, so shifting container security left makes delivery safer without making it slower.
What an Image Scanner Actually Finds
A container image is a stack of filesystem layers: a base OS (Debian, Alpine, Ubuntu, a distroless variant), language runtimes, your application's dependencies, and your code.
A scanner inventories those layers and reports four kinds of problem:
- Known vulnerabilities (CVEs) in OS packages (
openssl,glibc,zlib) and in language packages (npm, PyPI, Maven, Go modules, NuGet). Most of the volume comes from here, and most of that comes from the base image, not your code. - Embedded secrets: API keys, private keys or
.envfiles copied into a layer. Deleting a file in a later layer does not remove it from the earlier one; anyone who can pull the image can extract it. - Build misconfigurations in the Dockerfile itself: running as root, unpinned
FROMtags,ADDfrom remote URLs, package-manager caches and compilers left in the final image. - License and provenance issues: copyleft licenses your legal team cares about, or packages with no traceable origin.
The by-product that matters most is the SBOM (software bill of materials), the full package inventory in SPDX or CycloneDX format. The CVE list is a point-in-time view of that inventory. The SBOM is the durable asset: when a new critical CVE lands next month, you can answer "which of our images contain this?" in seconds without rebuilding or rescanning anything.
NIST's SP 800-190, Application Container Security Guide remains the clearest vendor-neutral treatment of these image risks. It calls out vulnerabilities, configuration defects, embedded malware, embedded secrets and untrusted images as distinct categories, each needing its own control.
Why "Fail the Build on Any HIGH" Backfires
The default gate most teams reach for is a severity threshold: fail if anything is HIGH or CRITICAL. It feels rigorous, but in practice it breaks three ways.
- Many findings have no fix yet: Distribution maintainers often mark a CVE as affecting a package long before, or without ever, shipping a patched build. Failing a build on something the developer cannot fix teaches them to bypass the gate.
- Severity is not risk: CVSS rates a flaw in the abstract. It doesn't know whether the vulnerable library is loaded at runtime, whether the container is internet-facing, or whether anyone is exploiting it in the wild.
- The base image dominates: If 90% of findings come from
FROM, then every service team gets the same flood, and every team is asked to fix a problem that only the platform team can fix properly, by updating the base.
When everything fails, nothing gets fixed, and the one CVE that matters is buried under 599 that don't.
Where to Scan: Five Checkpoints, Two Gates
Shift-left doesn't mean "scan only in CI." It means catching each class of problem at the earliest point where it can be found reliably and fixed cheaply. A mature pipeline has five checkpoints, but only two of them block.
- Code review: lint the Dockerfile. Root user, unpinned tags and secrets copied into layers are cheapest to fix while the PR is open. Report these as PR comments.
- CI build: scan the built image and generate the SBOM. This is your first gate. Block on a narrow policy (more on that below) and publish the SBOM next to the image.
- Registry: re-match continuously. An image that was clean on Monday can be critical on Thursday because a new CVE was published. Re-matching stored SBOMs against fresh vulnerability data catches this without rebuilding. Sign images here (for example with Sigstore's
cosign) so later stages can verify where they came from. - Admission: enforce provenance. The second gate lives in the cluster. An admission controller (Kyverno, OPA Gatekeeper or your platform's equivalent) refuses images that are unsigned, come from an unapproved registry, are referenced by
:latestinstead of an immutable digest, or have never been scanned. These checks are binary and cheap, which is exactly what you want in a blocking control. - Runtime: add context. Which images are actually deployed, where, with what network exposure and what identity? This doesn't block anything. It decides what gets fixed first, and it feeds back to the base-image owners.
A Gate Policy Developers Won't Route Around
The CI gate should block only when three things are true at once: the finding is serious, a fix exists, and the developer can apply it.
A practical starting policy could be:
- Block on CRITICAL vulnerabilities that have a fixed version available, on any vulnerability listed in CISA's Known Exploited Vulnerabilities (KEV) catalog that has a fix, and on any verified embedded secret.
- Warn on HIGH with a fix, on unfixed CRITICALs, and on Dockerfile misconfigurations. Surface them on the PR, but let the build pass.
- Record everything else in the SBOM and the vulnerability backlog without interrupting anyone.
- Allow time-boxed exceptions with an owner, a reason and an expiry date, stored in the repo next to the code (a
.trivyignoreor equivalent with comments).
Start narrower than feels comfortable, then tighten. A gate that fails one build in fifty for a real, fixable reason earns trust. A gate that fails every build gets disabled.
From 600 Findings to the Two That Matter
Gating handles new risk. You still have the existing backlog across every image already in production, and that's where prioritization earns its keep. Each filter below is a question the raw scanner output can't answer by itself.
- Is there a fix? If not, track it and look for a mitigation, but don't open a ticket a developer can't close.
- Is the package used at runtime? A vulnerable
curlor compiler left in a production image is still worth removing, but it's an image-hygiene fix (multi-stage builds, distroless bases), not an emergency patch. - Is it being exploited? KEV listings and exploit-prediction scores such as EPSS separate theoretical risk from active campaigns.
- Is the image deployed and exposed? The same CVE is urgent in an internet-facing pod with a privileged service account and routine in a batch job with no network ingress. This is the same reasoning behind attack path analysis: a finding's risk depends on what it connects to.
Then fix at the right layer. If forty services share a vulnerable base image, the fix is one base-image bump and forty automated rebuilds, not forty tickets. Make base images a product with an owner, a patch cadence and a published "golden" tag, and most of the volume disappears upstream.
Keeping It Fast
The "without slowing delivery" half of the promise comes down to a few engineering habits:
- Cache the vulnerability database: Store the vulnerability database in CI runners instead of downloading it for every job. This can reduce scan times significantly.
- Scan once, reuse the SBOM: Generate an SBOM at build time and attach it to the image as an attestation. Registry, admission, and runtime checks can reuse it instead of pulling and unpacking image layers again.
- Shrink the image: Use multi-stage builds and minimal or distroless base images to remove unnecessary packages and reduce vulnerabilities.
- Automate base-image updates: Use Renovate or Dependabot to update base images pinned to digests, ensuring patched versions arrive through routine pull requests.
- Assign findings to owners: Map container images to repositories and responsible teams so every vulnerability has a clear owner for remediation.
Image Scanning Is One Layer
An image scan tells you what's inside a container. It can't tell you that the pod running it mounts the host filesystem, that its service account can read every secret in the namespace, or that the cloud role it assumes can reach a production database. Those answers live in Kubernetes posture, cloud configuration and identity data. Our explainer on CSPM vs CNAPP vs CWPP covers why these layers need shared context rather than separate dashboards.
That's the problem the Offload Platform is built around. It's a unified CNAPP, vulnerability management and compliance platform that brings container image findings, SBOMs, code, cloud, Kubernetes and on-prem results into one governed risk view, so each image CVE shows where that image actually runs and whether that workload is exposed. It's available as SaaS or fully on-premises. If you're evaluating consolidated platforms, explore our guide to the best CNAPP tools to compare their capabilities, security coverage, and deployment options.
Whatever tooling you choose, the policy is what does the work. Scan everywhere, block in two places, carry the SBOM forward, and let context decide what gets fixed first. That's how container security shifts left without becoming the thing developers route around.