Trivy Cheatsheet

← All cheatsheets
$ trivy image --severity HIGH,CRITICAL nginx
BeginnerSecurityUpdated October 2026

Scan images, file systems, IaC and live clusters for vulnerabilities, secrets and misconfigurations with Trivy.

Image scanning

trivy image nginx:1.27Scan an image for known CVEs
trivy image --severity HIGH,CRITICAL nginx:1.27Only show high and critical issues
trivy image --ignore-unfixed python:3.12Hide issues with no fix yet
trivy image --exit-code 1 --severity CRITICAL myapp:latestFail CI on critical issues
trivy image --format sarif -o results.sarif myapp:latestExport results for GitHub code scanning
trivy image --format cyclonedx -o sbom.json myapp:latestGenerate an SBOM
trivy sbom sbom.jsonScan an existing SBOM

Code, config and repos

trivy fs --scanners vuln,secret,misconfig .Scan a project folder
trivy config ./manifestsCheck Kubernetes YAML, Helm and Terraform for misconfigs
trivy repo https://github.com/org/repoScan a remote Git repo

Kubernetes

trivy k8s --report summarySummary scan of the current cluster
trivy k8s --include-namespaces prod --report allFull scan of one namespace
helm repo add aqua https://aquasecurity.github.io/helm-charts/Add the Aqua chart repo
helm install trivy-operator aqua/trivy-operator -n trivy-system --create-namespaceInstall the Trivy Operator for continuous scans
kubectl get vulnerabilityreports -AList image vulnerability reports
kubectl get configauditreports -AList config audit reports

Housekeeping

trivy image --download-db-onlyPre-download the vulnerability database
trivy clean --allClear Trivy caches
echo "CVE-2024-12345" >> .trivyignoreIgnore a CVE you have accepted