Guides

How to scan a Docker image for vulnerabilities

Updated 2026-11-17

Short answer

To scan a Docker image for vulnerabilities, give a scanner the image name and tag, let it list every package inside the image, and compare that list with public vulnerability databases. With scancontainer you type the image name on the home page or push the image with docker push, and you get a report with the fixes in order of importance.

What a scan looks at

  • Operating system packages: Debian, Ubuntu, Alpine, Red Hat and the other distributions.
  • Language packages: Python, Node.js, Java, Go, Rust, .NET, Ruby and PHP.
  • Software installed without a package manager, such as binaries copied by hand or libraries built into other binaries.
  • The configuration of the image: user, exposed ports, base image and build history.
  • Secrets left in files, environment variables or deleted layers.

Step by step

  1. Choose the exact image. Use a tag or, better, a digest, so you scan what you will deploy.
  2. Send it to the scanner: type its name, upload a .tar made with docker save, or push it to the scanner as if it were a registry.
  3. Read the verdict first, then the top fixes.
  4. Fix the base image before anything else. Moving to a supported base image usually clears most findings at once.
  5. Scan again to confirm the fix.
  6. Add the scan to your CI pipeline so every build is checked.

What to fix first

A long list of CVEs is not a plan. For each vulnerability ask four questions: does it affect the version you have, does it apply to how the image is built, can it be reached from outside, and is there a fix. Start with the ones where all four answers are yes, and with any that are being exploited in the wild.

Common mistakes

  • Scanning only the latest tag and deploying another one.
  • Ignoring the base image and patching packages one by one.
  • Deleting a secret in a later layer: it is still in the earlier layer.
  • Reading 'no findings' as 'clean' when the scanner could not read part of the image.

More guides

Scan yours before the next deploy.