Trivy and Grype report different CVE counts for the same image
IntermediateTroubleshootingContainer image and IaC scanning
Answer
Likely causes → Different advisory sources (distro feeds vs NVD vs GHSA), different handling of unfixed and disputed CVEs, and different package detection (language binaries, JARs inside JARs).
Diagnose →
trivy image -f json -o t.json myapp:1.4
grype myapp:1.4 -o json > g.json
jq -r '.Results[].Vulnerabilities[]?.VulnerabilityID' t.json | sort -u > t.txt
jq -r '.matches[].vulnerability.id' g.json | sort -u > g.txt
comm -3 t.txt g.txt
Fix → Pick one scanner as the gate of record and use the other for second opinion. Investigate the diff list; most differences are severity source or unfixed handling.
Prevent → Document the scanner, DB source and severity policy so audits and developers see one answer.
More on Container image and IaC scanning
Trivy fails the build on 14 HIGH/CRITICAL CVEs in the base image, all with "Fixed Version" emptyBeginner`FATAL ... failed to download vulnerability DB: ... TOOMANYREQUESTS: retry-after` from Trivy in CIIntermediateTrivy in an air-gapped runner fails with `failed to download vulnerability DB` even though you copied `db.tar.gz`Advanced`.trivyignore` entries are ignored and the build still fails on the same CVEBeginnerTrivy reports a critical CVE in a Go binary built from your own code, in package `stdlib`IntermediateImage scan passes in CI but the registry scanner (ECR enhanced scanning / Harbor) shows criticals a week laterBeginner