Container Image Security Scanning: A Practical Workflow for Vulnerabilities, Secrets, and Misconfigurations
container securityDockerKubernetesimage scanningvulnerability remediationDevSecOps

Container Image Security Scanning: A Practical Workflow for Vulnerabilities, Secrets, and Misconfigurations

SSecurity Quest Editorial Team
2026-11-10
7 min read

A reusable checklist for scanning container images, prioritizing vulnerabilities, detecting secrets, and deciding when to rebuild before deployment.

Container image security scanning is most useful when it is treated as a repeatable release workflow rather than a one-time check. This guide provides a practical checklist for finding operating-system and package vulnerabilities, embedded secrets, and insecure image configuration; prioritizing the results; and deciding when an image must be rebuilt before deployment.

Overview

A container image can carry more risk than the application code it packages. Its layers may include an operating-system base, language runtimes, third-party libraries, command-line utilities, configuration files, credentials, and build artifacts. A Docker image security scanner or comparable container security scanning tool should examine these layers before the image reaches a registry or production environment.

Scanning is not the same as proving that an image is safe. Results depend on the image contents, the scanner's vulnerability database, the way packages are identified, and the runtime context. A finding in an unused package may deserve a different response from a remotely exploitable library in an internet-facing service. The goal is therefore risk-based container vulnerability management: identify what is present, understand how it can be reached, assign ownership, and apply a proportionate fix.

A durable workflow normally has four scan points:

  1. During development: scan locally or in a pre-commit workflow when practical, especially after changing the base image or dependency manifest.
  2. At build time: scan the newly built image before it is tagged as releasable.
  3. At registry admission: rescan stored images and apply repository or environment policies.
  4. After deployment: compare image findings with runtime exposure, configuration, identity, and cloud context.

Use the scanner as one part of a secure SDLC. Source analysis, dependency analysis, API security testing, and cloud security scanning cover different parts of the system. For a broader view of scan placement, see SAST vs DAST vs SCA: Which Security Scan Belongs in Each Development Stage?.

Checklist by scenario

Before building the image

  • Record the base image, digest or equivalent immutable reference, and supported architecture.
  • Prefer a maintained base appropriate to the application rather than selecting an image solely because it is small.
  • Review package manifests and lockfiles for direct and transitive dependencies.
  • Use a build process that keeps source repositories, local credentials, test data, and private keys out of the final context.
  • Separate build stages from the runtime stage so compilers, package managers, and test tools are not copied unnecessarily into production.

When scanning a newly built image

  • Scan the exact image digest intended for deployment, not only the source directory or an earlier tag.
  • Run an operating-system and package vulnerability scan across all image layers that remain available to the final image.
  • Run secret detection against files, layer history, environment defaults, and common credential formats.
  • Check image configuration for root execution, writable sensitive paths, exposed ports, unsafe defaults, unnecessary set-user-ID files, and debugging utilities.
  • Capture the scan timestamp, image digest, scanner version, database or feed version where available, and result summary as release evidence.
  • Compare the result with the previous approved image to distinguish new findings from accepted or already tracked risk.

When a vulnerability is reported

Do not prioritize solely by the scanner's severity label. Combine technical severity with exploitability, exposure, and business context.

Finding patternQuestions to askTypical next action
High severity, remotely reachable package in an internet-facing serviceIs the affected component loaded? Is the vulnerable function exposed? Is exploitation known or plausible?Escalate for an urgent upgrade, replacement, configuration change, or temporary containment.
High severity package in an internal workerCan untrusted input reach the worker? What identities and networks can access it?Assign a clear owner and deadline based on reachable attack paths and service criticality.
Low or medium severity package with no practical attack pathIs the component used at runtime? Can it be removed from the final stage?Remove, upgrade, or track through normal maintenance rather than creating unnecessary emergency work.
Credential or private key detectedCould it still be valid? Where was it used? Is it present in image history or a registry?Revoke or rotate it immediately, investigate access, then rebuild without the secret.
Unsafe image configurationDoes deployment override the setting? Could the container gain unnecessary privilege or write access?Correct the Dockerfile, image metadata, deployment manifest, or runtime policy and retest.

Before deployment

  • Confirm that the deployment references an immutable image digest or an approved release artifact.
  • Review whether the image is running with a non-root user and only the capabilities it needs.
  • Verify that runtime secrets are injected through an approved secret-management path rather than baked into the image.
  • Check that network policy, filesystem permissions, resource limits, and admission controls match the service's risk.
  • Decide which findings block the release and which require a documented exception. The decision should be consistent with the team's risk policy; see When Should a Security Scan Fail the Build?.

What to double-check

Package identification and false positives

Container scanners identify packages through operating-system metadata, language manifests, binaries, and other signals. A version match can be incomplete or misleading when a vendor backports a security fix without changing the upstream version in the expected way. Conversely, a package may be reported even though the relevant code is not used. Check the finding's evidence, installed version, fixed version, affected path, and advisory context before closing it.

When the result appears incorrect, document why rather than deleting it silently. A useful exception records the image digest, package and finding identifier, reason for the decision, compensating controls, owner, approval, and expiration or review date. This supports false positive reduction without losing audit history.

Image layers and build history

Deleting a secret in a later layer may not remove it from earlier layers. Similarly, a package removed from the final filesystem may remain visible in an intermediate image or registry artifact, depending on what is being scanned. Use multi-stage builds, avoid copying sensitive files into the build context, and verify the final artifact rather than assuming a cleanup command erased historical content.

Scanner coverage and database behavior

Record what the scan actually covers: image format, operating systems, language ecosystems, secret patterns, configuration checks, registry sources, and supported architectures. Vulnerability databases change as advisories are corrected, package mappings improve, and fixes become available. A later rescan can therefore produce a different result even when the image digest has not changed. Treat that change as a triage event, not automatically as a newly introduced defect.

Evidence and ownership

Every actionable finding should have a service owner, repository or image reference, severity rationale, remediation plan, and target date. Store scan results in a system where developers can see the affected package and recommended fix in the context of their service. Monthly metrics can help expose aging findings and ownership gaps; the guide to security scanning metrics and KPIs provides a useful companion workflow.

Common mistakes

  • Scanning only at the end of the pipeline: Late feedback makes remediation expensive. Add an earlier image scan while keeping the release scan as the authoritative gate.
  • Using severity as the entire priority model: Add reachability, exploitability, asset criticality, runtime privileges, and available fixes.
  • Ignoring secrets because the image is private: Registries, logs, pull credentials, backups, and developer workstations can broaden exposure. Rotate any potentially valid secret.
  • Fixing the running container manually: Manual changes disappear when the container is replaced. Correct the Dockerfile, dependency lockfile, build process, or deployment policy and rebuild.
  • Updating every package without testing: Broad upgrades can introduce compatibility problems. Prefer a controlled update, test the service, and record the resulting image digest.
  • Allowing permanent exceptions: An exception without an owner and review date becomes hidden risk. Set an expiry or a defined reassessment condition.
  • Comparing tags instead of immutable artifacts: Tags can move. Use digests when comparing releases, approving deployments, and retaining evidence.
  • Treating a clean image scan as a clean deployment: Runtime permissions, Kubernetes configuration, cloud identity, network exposure, and application behavior still require separate checks.

When to revisit

Revisit this checklist whenever a base image, operating-system package, language runtime, dependency lockfile, build action, scanner, registry, or deployment platform changes. Also rescan when a new relevant advisory is published, an image moves into a more exposed environment, a service gains a new integration, or a previously accepted exception expires.

Before each planned release, confirm the following:

  1. The exact image digest has been scanned for vulnerabilities, secrets, and configuration issues.
  2. New findings have an owner and a documented priority based on exposure and exploitability.
  3. Critical or urgent findings have been fixed, contained, or approved through a time-bound exception.
  4. Fixes were applied in source and build definitions, followed by a clean rebuild and retest.
  5. The deployment uses the approved digest and does not reintroduce privileged settings or baked-in secrets.
  6. Scan evidence and exception records are retained where the team manages compliance or audit requests.

After a meaningful change, compare the new result with the previous baseline so the team can focus on drift rather than repeatedly reopening known findings. The security scan baselines and drift detection guide can help structure that comparison. A container security scanning program remains effective when it is repeatable, ownership-driven, and connected to the way images are actually built and deployed.

Related Topics

#container security#Docker#Kubernetes#image scanning#vulnerability remediation#DevSecOps
S

Security Quest Editorial Team

Security and DevSecOps Editors

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.