Trivy Cheat Sheet
Scan images, filesystems, Git repos, and Kubernetes clusters for vulnerabilities, misconfigurations, and secrets.
Security4 sections · 21 commands
⌘K
Scanning Images
7trivy image IMAGEScan an image for CVEs
trivy image --severity CRITICAL,HIGH IMAGEFilter by severity
trivy image --ignore-unfixed IMAGESkip unfixed (no patch yet)
trivy image --format sarif --output out.sarif IMAGESARIF report (SIEM/CI)
trivy image --exit-code 1 --severity CRITICAL IMAGEFail the build on criticals
trivy image --scanners vuln,secret IMAGEEnable multiple scanners
trivy image --platform linux/amd64 IMAGEScan a specific platform
Filesystem & Repos
5trivy fs .Scan the working directory
trivy fs --exclude-patterns 'node_modules/**' .Skip noisy directories
trivy repo URL --scan-vulnScan a public Git repo
trivy config .Check IaC/SECURITY misconfigs
trivy rootfs ROOT_DIRScan a root filesystem
Kubernetes & Secrets
5trivy k8s cluster --report summaryScan the whole cluster
trivy k8s --namespace NSScan one namespace
trivy image --scanners secret IMAGEFind secrets in image layers
trivy sbom IMAGEGenerate a software bill of materials
trivy auth login REGISTRYRegister an image registry
CI & Reporting
4trivy image --cache-dir .cache IMAGECustom cache path
trivy image --no-progress IMAGESilent output for CI
trivy image --template @tmpl --format template IMAGECustom output template
trivy image --db-repository ghcr.io/aquasecurity/trivy-db IMAGEAir-gapped DB mirror