Sub topic 5
Reading vulnerability lists with docker scout cves
docker scout quickview gives you counts. docker scout cves gives you the findings behind those counts: which package is affected, which CVE applies, how severe it is, and which version fixes it. This chapter covers how to run the command, how to read its output, and which flags narrow a long list to the findings you can act on.
Prerequisites
This chapter assumes you have:
- Docker Desktop, or Docker Engine with the Scout CLI plugin, and you are signed in to Docker.
- The ideas from earlier chapters: image layers, CVE identifiers, severity ratings, and the "fixed version" field.
- Run
docker scout quickviewon at least one image.
What the command does
docker scout cves analyzes an image and lists the known vulnerabilities in it. Scout first builds an inventory of the packages in the image (an SBOM). It then matches each package version against its advisory database. The command prints the matches.
docker scout cves nginx:latestIf the image is not stored locally, Scout pulls its metadata from the registry. To analyze an image you built locally, name its source explicitly with a prefix:
docker scout cves local://myapp:1.0
docker scout cves registry://nginx:latest
docker scout cves fs://.local://uses the image in your local Docker image store.registry://uses the image in the registry and ignores any local copy.fs://.analyzes a directory, which is useful for checking application dependencies before you build an image.
Without a prefix, Scout chooses a source for you. If a local tag and a registry tag differ, the prefix makes sure you scan the one you meant to.
Anatomy of the output
The output has two parts: an overview, then a list of packages with their vulnerabilities. The following is abridged and illustrative. Your package names, versions and CVE IDs will differ.
## Overview
│ Analyzed Image
────────────────────┼──────────────────────────────
Target │ myapp:1.0
digest │ 3f1a9c0d7b2e
platform │ linux/amd64
vulnerabilities │ 0C 1H 2M 5L
size │ 118 MB
packages │ 142
## Packages and Vulnerabilities
1H 0M 0L openssl 3.0.11-1~deb12u1
pkg:deb/debian/[email protected]~deb12u1?os_distro=bookworm
✗ HIGH CVE-2024-00000
https://scout.docker.com/v/CVE-2024-00000
Affected range : <3.0.13-1~deb12u1
Fixed version : 3.0.13-1~deb12u1Read it from the top:
- Overview. The
0C 1H 2M 5Lline gives counts of critical, high, medium and low findings. It matches the numbers inquickview. Thepackagescount tells you how large the inventory was. A scan that reports 0 packages usually means Scout could not read the image, which is different from a clean image. - Package header. Each package line shows its own severity counts, then its name and version. Packages are sorted with the worst first.
- Package URL (purl). The
pkg:deb/debian/openssl@...string identifies the package by ecosystem (deb), vendor (debian), name and version. It tells you whether the package came from the operating system or from a language ecosystem such aspkg:npmorpkg:pypi. - Finding. Each CVE line shows severity, the ID, and a link to its page in the Scout database.
- Affected range and fixed version. The affected range says which versions are vulnerable. The fixed version says what to upgrade to. If there is no fixed version line, no fix has been released for that distribution.
Narrowing the list
An unfiltered scan of a general-purpose image can list hundreds of findings, most of them low severity. These flags cut the list down.
| Flag | Effect |
|---|---|
| `--only-severity critical,high` | Show only the severities you name. |
| `--only-fixed` | Show only vulnerabilities that have a fixed version. |
| `--only-unfixed` | Show only vulnerabilities with no fix yet. |
| `--ignore-base` | Leave out vulnerabilities that come from the base image layers. |
| `--only-package-type npm,deb` | Restrict results to certain package types. |
| `--only-cve-id CVE-2024-00000` | Show a single CVE, useful when checking one advisory. |
Combine them. The most common triage query is serious findings that you can fix:
docker scout cves --only-severity critical,high --only-fixed local://myapp:1.0To see only what your own Dockerfile introduced, exclude the base image:
docker scout cves --ignore-base local://myapp:1.0Be careful with --only-fixed. It hides findings that have no fix, but those findings are still in your image. Use it to build a work list, not to claim the image is clean.
Choosing an output format
The default output is a human-readable report. For other uses, pick a format with --format:
docker scout cves --format packages local://myapp:1.0
docker scout cves --format sarif --output scout.sarif.json local://myapp:1.0
docker scout cves --format markdown --output scout.md local://myapp:1.0packagesprints a list of the packages in the image, which is closer to an SBOM view than a vulnerability view.sarifwrites the Static Analysis Results Interchange Format. Code scanning tools, including GitHub's, can import it.markdownproduces a report you can paste into a pull request or ticket.
The --output flag writes to a file instead of the terminal.
Details and severity ratings
Add --details for longer descriptions of each CVE directly in the output. Without it, Scout prints just the headline and a link.
docker scout cves --details --only-severity critical local://myapp:1.0The severity comes from the advisory data Scout uses. When several sources disagree, Scout applies its own selection rules. A CVE may therefore be rated differently here than on another site or in another scanner. Do not treat a single rating as ground truth. Treat it as a starting point for the questions below.
- Is the vulnerable code reachable in how you run the container?
- Is a fixed version available?
- Is the package in the final image at all, or only in a build stage?
Using the exit code
By default docker scout cves exits with status 0 even when it finds vulnerabilities. Add --exit-code and the command exits with a non-zero status if any vulnerability matches your filters:
docker scout cves --only-severity critical,high --only-fixed --exit-code local://myapp:1.0
echo "exit status: $?"Place your filters before --exit-code. The exit code reflects only what remains after filtering. If you filter to --only-severity critical, a high finding will not fail the command. A later chapter uses this behavior in a CI gate.
Common errors
- Zero vulnerabilities and zero packages. Scout could not identify the image contents. Check the image name, the prefix (
local://orregistry://), and that you are signed in. - Different results from
quickview.quickviewsummarizes everything. If you used filters oncves, the counts will not match. Run both commands without filters to compare. - Results change with no new build. The advisory database updates continuously. The same image digest can gain findings tomorrow. Re-scan images you have already shipped.
- Wrong image analyzed. A local tag and a registry tag of the same name can point to different builds. Use an explicit prefix, or scan by digest.
- Fixed version cannot be installed. The fix may exist upstream but not yet in your distribution's package repository, or your base image tag has not been rebuilt. Rebuild without cache (
docker build --pull --no-cache) to pick up current packages.
Exercises
Exercise
You run docker scout cves --only-fixed --only-severity high local://myapp:1.0 and get no results. A teammate says the image has no serious vulnerabilities. Give two reasons the claim might be wrong.
Show answer
First, --only-severity high excludes critical findings, which are more serious than high. Second, --only-fixed hides vulnerabilities that have no fixed version, so unfixed high findings are still present but not shown. Rerun with --only-severity critical,high and without --only-fixed to see the full picture.
Exercise
Which command lists only the vulnerabilities your own Dockerfile layers introduced, excluding those from the base image, for the local image myapp:1.0?
Show answer
docker scout cves --ignore-base local://myapp:1.0