Sub topic 15
Why Docker Scout and Trivy Can Disagree
This chapter assumes you have run docker scout cves and trivy image on an image and can read a CVE list. You should also know what an SBOM is and how severity and fixed versions are reported. Here you will learn why two scanners can report different results for the same image, and how to handle the differences.
Same image, different numbers
Suppose you scan python:3.12-slim with both tools:
docker scout cves --only-severity critical,high python:3.12-slim
trivy image --severity HIGH,CRITICAL python:3.12-slimThe totals will often not match. Neither tool is necessarily wrong. Each scan has three steps, and the tools can differ at any of them:
- Build an inventory of the packages in the image.
- Match that inventory against advisory data.
- Decide how to rate and report each match.
Where the differences come from
| Step | What can differ |
|---|---|
| Package detection | Which package managers, language ecosystems and binaries each tool recognizes |
| Advisory data | Which databases are used and how often they update |
| Severity | Whether the rating comes from the distribution, the vendor or the NVD |
| Fix status | Whether a fixed version is known to the tool's data source |
| Defaults | What each command hides or shows without extra flags |
Package detection
A scanner can only report on what it finds. Both tools read OS package databases and common lockfiles. They may differ on statically linked binaries, files copied in without a package manager, or unusual lockfile layouts. A package that one tool never detects can never produce a finding.
Advisory data
Each tool pulls from its own set of sources and refreshes on its own schedule. A CVE published this morning may appear in one tool's data a few hours or a day before the other. Rescanning later can therefore change results even when the image has not changed.
Severity and fix status
A CVE can carry different ratings from different sources. A Linux distribution may rate a flaw as low for its build, while the NVD rates it high. Whichever source a tool prefers decides which severity filter catches it. The same applies to fixed versions. A distribution may mark a package as "will not fix" while upstream has a patch.
Defaults
Compare like with like. The earlier Trivy example used --ignore-unfixed, which hides findings with no fix. Check whether the Scout command you compare against hides the same findings. A mismatch in flags alone can explain a large gap.
Comparing results in practice
Export both reports in a machine-readable form and compare the CVE IDs, not the totals. For Trivy:
trivy image --format json --output trivy.json python:3.12-slimThen look at the CVEs found by only one tool. For each one, ask:
- Is the package present in the image at all?
- Does the tool's advisory source list this CVE for that package version?
- Do the two tools rate it at the same severity?
The answers usually point to a detection gap, a data-source difference or a severity difference.
Choosing and combining
Use one tool consistently for gating CI, so results are stable from build to build. Switching tools changes the baseline and can break builds or hide regressions. Run the second tool occasionally as a cross-check, especially before a release. A finding reported by both tools deserves attention first. A finding reported by only one deserves a quick look at the package and advisory source before you act on it or dismiss it.
Exercise
Scout reports 12 high findings for an image and Trivy reports 7. You had run Trivy with --ignore-unfixed. Name two checks you would make before deciding which tool is right.
Show answer
First, run both tools with the same filters, or remove --ignore-unfixed, so you compare the same set of findings. Second, export both reports and compare CVE IDs to find the findings that only one tool reports. Then check whether the package is present, whether the advisory source lists it, and how each tool rates its severity.