← All cheatsheets
$ trivy image --severity HIGH,CRITICAL nginxScan 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 CVEstrivy image --severity HIGH,CRITICAL nginx:1.27Only show high and critical issuestrivy image --ignore-unfixed python:3.12Hide issues with no fix yettrivy image --exit-code 1 --severity CRITICAL myapp:latestFail CI on critical issuestrivy image --format sarif -o results.sarif myapp:latestExport results for GitHub code scanningtrivy image --format cyclonedx -o sbom.json myapp:latestGenerate an SBOMtrivy sbom sbom.jsonScan an existing SBOMCode, config and repos
trivy fs --scanners vuln,secret,misconfig .Scan a project foldertrivy config ./manifestsCheck Kubernetes YAML, Helm and Terraform for misconfigstrivy repo https://github.com/org/repoScan a remote Git repoKubernetes
trivy k8s --report summarySummary scan of the current clustertrivy k8s --include-namespaces prod --report allFull scan of one namespacehelm repo add aqua https://aquasecurity.github.io/helm-charts/Add the Aqua chart repohelm install trivy-operator aqua/trivy-operator -n trivy-system --create-namespaceInstall the Trivy Operator for continuous scanskubectl get vulnerabilityreports -AList image vulnerability reportskubectl get configauditreports -AList config audit reportsHousekeeping
trivy image --download-db-onlyPre-download the vulnerability databasetrivy clean --allClear Trivy cachesecho "CVE-2024-12345" >> .trivyignoreIgnore a CVE you have accepted