Safeguard
Developer Tools•

How do I scan a GPU inference container image for vulnerabilities?

Scan each layer of a GPU inference image: OS, GPU libraries, Python packages and your app. Build an SBOM at build time and rescan after release.

Safeguard Security Team
3 min read

To scan a GPU inference container image, scan the finished image rather than only your requirements file, covering OS packages, GPU runtime libraries, Python packages, and your application layer. Generate an SBOM during the build, fail the pipeline on reachable critical findings, and rescan deployed images on a schedule.

What is inside the image

A serving image usually stacks four layers, and each one has its own source of vulnerabilities.

LayerExamplesWho patches it
Base OSDistribution packages, shell, certificatesYou, by rebuilding on a newer base
GPU and system librariesVendor runtime libraries pulled in by the base imageYou, by choosing a newer base tag
Python environmentFramework, serving runtime, tokenizers, transitive packagesYou, through lockfile updates
Your applicationHandlers, auth, tenant logicYou, through code changes

Scanning only the Python lockfile misses the first two rows. Scanning only the image can hide which of your own dependencies introduced a finding. Do both and join the results.

Steps

  1. Pin the base image by version tag, and by digest in production, so rebuilds are repeatable.
  2. Generate an SBOM at build time. Docker BuildKit can attach one with the flag --attest type=sbom (shorthand --sbom=true), which stores the inventory with the image. Use BUILDKIT_SBOM_SCAN_STAGE if you use multi stage builds and want earlier stages included.
  3. Scan the image against vulnerability data and rank findings by reachability and exposure.
  4. Gate the pipeline on new critical, reachable findings, not on the total count.
  5. Rescan what is already deployed. New advisories appear after you ship, so a clean scan on release day does not stay clean.
  6. Trim the image. Multi stage builds that leave compilers and build tools behind shrink what can be flagged and what an attacker can use.

Common mistakes

  • Treating model weights as part of the scan. Weight files are data and need provenance and format checks, which an image scanner does not give you. See loading weights safely.
  • Baking secrets into layers. A deleted file can still sit in an earlier layer.
  • Pulling a floating tag in production.

Try it yourself

Run the container image scan demo. Look at which findings come from the OS layer and which from Python packages.

Click through it at your own pace, or open it full screen.

A short note on Safeguard

Safeguard scans container images, produces SBOMs, and applies policy gates in CI. Try a free scan at gold.safeguard.sh/scan.

Quick check

Do GPU images need a different scanner?

No special scanner is needed. The image is still OS packages and language packages. What differs is that the base is larger, so rebuilds on newer bases matter more.

How often should deployed images be rescanned?

On a schedule and whenever a high profile advisory lands. Daily is common for production images.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.