Skip to content
Trivy

Trivy

Category: IaC Security
License: Free (Open-Source, Apache 2.0)
Suphi Cankurt
Suphi Cankurt
AppSec Enthusiast
Updated February 21, 2026
5 min read
Key Takeaways
  • Most-starred open-source security scanner on GitHub with 32.2k stars, 513+ contributors, and 178+ releases under Apache 2.0 license.
  • Single binary scans 5 target types (container images, filesystems, git repos, VM images, Kubernetes clusters) with 4 scanner engines (vulnerabilities, misconfigurations, secrets, licenses).
  • Absorbed tfsec — all Terraform security checks (AVD-AWS-0086 etc.) now run via 'trivy config .' with identical check IDs and drop-in migration.
  • Default scanner in Harbor (CNCF registry), with integrations for GitHub Actions, GitLab CI, AWS Security Hub, and Kubernetes Operator for continuous cluster scanning.

Trivy is an open-source security scanner by Aqua Security. It scans container images, filesystems, git repositories, virtual machine images, and Kubernetes clusters for vulnerabilities, misconfigurations, secrets, and license issues. One binary, five target types, four scanner engines.

With 32.2k GitHub stars, 513+ contributors, and 178+ releases, it is the most-starred open-source security scanner on GitHub. The latest release is v0.69.1 (February 2026).

Trivy container image scan showing vulnerability table with CVE IDs, severity levels, and affected packages

What Trivy does

Trivy started as a container vulnerability scanner. It has since absorbed tfsec (Terraform security scanner) and grown into a multi-target tool that covers most of what DevSecOps teams need from a single CLI.

The scanner works locally, in CI/CD pipelines, and as a Kubernetes operator. Written in Go, it ships as a static binary with no dependencies. Install it, point it at a target, get results.

Vulnerability Detection
Scans OS packages and application dependencies against Aqua’s vulnerability database. Covers Alpine, Debian, Ubuntu, RHEL, CentOS, Amazon Linux, and more.
IaC Misconfigurations
Detects security issues in Terraform, CloudFormation, Kubernetes manifests, Helm charts, Dockerfiles, Azure ARM templates, and Ansible. Inherited tfsec’s full check library.
Secrets & Licenses
Finds hardcoded API keys, passwords, private keys, and cloud credentials. Also identifies software licenses in dependencies for compliance tracking.

Key features

FeatureDetails
TargetsContainer images, filesystems, git repos, VM images, Kubernetes clusters, SBOMs
ScannersVulnerabilities, misconfigurations, secrets, licenses
OS coverageAlpine, Debian, Ubuntu, RHEL, CentOS, Amazon Linux, SUSE, Photon, Windows
Language ecosystemsGo, Java, Node.js, Python, Ruby, Rust, PHP, .NET, Dart, Elixir, Swift
IaC typesTerraform, CloudFormation, Kubernetes, Helm, Dockerfile, ARM, Ansible (CIS-aligned)
Output formatsTable, JSON, SARIF, CycloneDX, SPDX, template-based custom formats
SBOM generationCycloneDX and SPDX for container images and filesystems
Policy engineRego (OPA) for custom misconfiguration checks
KubernetesCluster scanning, workload assessment, KBOM (Kubernetes Bill of Materials)
Databasestrivy-db (general vulnerabilities), trivy-java-db (JAR/WAR identification)

Container image scanning

Trivy scans Docker and OCI images for known vulnerabilities in both OS packages and application dependencies. Point it at any image reference and it pulls the layers, extracts packages, and checks them against its vulnerability database.

Results include the CVE ID, severity, installed version, fixed version (if available), and a link to the advisory. You can filter by severity to focus on HIGH and CRITICAL findings only.

IaC misconfiguration scanning

After absorbing tfsec, Trivy’s misconfiguration scanner covers Terraform, CloudFormation, Kubernetes manifests, Helm charts, Dockerfiles, ARM templates, and Ansible playbooks.

Drop your IaC files in a directory and run trivy config ./. Trivy auto-detects the file types and applies the right checks. No need to specify which IaC format you’re using.

Custom checks use Rego (the OPA policy language). Write your own rules and place them alongside the built-in check set.

tfsec migration
tfsec was fully merged into Trivy. All tfsec check IDs (like AVD-AWS-0086) work in Trivy’s misconfiguration scanner. The tfsec repository now redirects users to Trivy.

Kubernetes cluster scanning

Trivy scans running Kubernetes clusters directly. The trivy k8s command connects to your cluster and checks workloads for vulnerabilities, misconfigurations, and secrets.

Trivy Kubernetes cluster scan summary showing workload and infra assessment with vulnerability and misconfiguration counts

Two report modes are available: summary gives a quick overview per namespace, and all provides the full detail for every resource. The Trivy Operator can run these scans continuously inside the cluster.

Filesystem and repository scanning

Trivy scans local directories and remote git repositories for vulnerabilities in application dependencies. It reads lock files (package-lock.json, go.sum, Gemfile.lock, requirements.txt, and others) to identify packages and check them against known CVEs.

Trivy filesystem scan results showing Java dependency vulnerabilities with CVE IDs and severity ratings

The filesystem scanner also picks up secrets and IaC misconfigurations in the same pass. Run trivy fs --scanners vuln,secret,misconfig . to get everything at once.

Secret detection

The secret scanner uses regex patterns to find hardcoded credentials: API keys, passwords, private keys, cloud access keys, and database connection strings. It runs against any target type — container images, filesystems, or repositories.

SBOM generation

Trivy generates Software Bill of Materials in CycloneDX and SPDX formats. Useful for supply chain compliance, vulnerability tracking, and responding to incidents like Log4Shell where you need to know which images contain a specific library.

# CycloneDX format
trivy image --format cyclonedx myapp:latest > sbom.json

# SPDX format
trivy image --format spdx-json myapp:latest > sbom.spdx.json

VM image scanning

Trivy also scans virtual machine images. Amazon Machine Images (AMIs) and other VM formats go through the same vulnerability database used for container scanning.

Getting started

1
Install Trivy — Use Homebrew (brew install trivy), apt (sudo apt-get install trivy), Docker (docker run aquasec/trivy), or download the binary from GitHub releases. Available for Linux, macOS, and Windows.
2
Scan a container image — Run trivy image nginx:latest to check a container image for vulnerabilities. Add --severity HIGH,CRITICAL to filter results.
3
Scan IaC files — Run trivy config ./terraform/ to check Terraform files for misconfigurations. Trivy auto-detects the IaC type.
4
Scan a Kubernetes cluster — Run trivy k8s --report summary cluster to assess all workloads in your cluster.
5
Generate an SBOM — Run trivy image --format cyclonedx myapp:latest > sbom.json to produce a CycloneDX bill of materials.

CI/CD integration

Trivy fits into any CI/CD pipeline. The official GitHub Action (aquasecurity/trivy-action) handles container image and IaC scanning with SARIF output for GitHub Code Scanning.

For GitLab CI, the Docker image runs in a security stage. Jenkins and CircleCI work through the CLI binary. Exit codes control whether builds pass or fail: set --exit-code 1 with --severity HIGH,CRITICAL to fail on serious findings only.

Trivy scanning a remote git repository showing vulnerability findings across multiple dependency files

Severity gating
Use trivy image --exit-code 1 --severity HIGH,CRITICAL myapp:latest to fail CI builds only when HIGH or CRITICAL vulnerabilities are found. This avoids blocking deployments over LOW/MEDIUM findings that can be addressed later.

Integrations

CI/CD & DevOps
GitHub Actions GitHub Actions
GitLab CI GitLab CI
CircleCI CircleCI
Jenkins Jenkins
Container Registries
Docker Hub Docker Hub
GitHub Container Registry GitHub Container Registry
Amazon ECR Amazon ECR
Google Artifact Registry Google Artifact Registry
Kubernetes & Cloud
Kubernetes Operator Kubernetes Operator
Harbor Harbor
AWS Security Hub AWS Security Hub

Configuration

Create a trivy.yaml file to set defaults:

severity:
  - HIGH
  - CRITICAL

vulnerability:
  ignore-unfixed: true

misconfiguration:
  terraform:
    exclude-downloaded-modules: true
# To skip specific checks, use a .trivyignore file:
# Create .trivyignore with check IDs (one per line):
#   AVD-AWS-0086
# Or use CLI: trivy config --skip-checks AVD-AWS-0086 .

The ignore-unfixed option hides vulnerabilities with no available patch. Useful for reducing noise in reports when you can only act on fixable issues.

Individual findings can be suppressed with a .trivyignore file listing CVE IDs or check IDs, one per line.

When to use Trivy

Trivy works well when you want a single scanner that handles containers, IaC, secrets, and dependencies without stitching together separate tools. Getting all of that from one binary is why most teams reach for it first.

It’s the default scanner in Harbor (the CNCF container registry) and has integrations with GitLab, AWS Security Hub, and the Kubernetes operator ecosystem. If you’re already in that stack, Trivy slots in with minimal setup.

For IaC-specific scanning with a larger policy library, Checkov or KICS offer more checks and compliance framework mappings. For commercial support and curated fix recommendations, Snyk IaC is worth evaluating. But if you want one open-source tool that does most of the job, Trivy is the obvious starting point.

For a broader view of IaC security strategy, see our cloud infrastructure security guide. Browse other IaC security tools to compare options.

Frequently Asked Questions

What is Trivy and what can it scan?
Trivy is an open-source security scanner maintained by Aqua Security. It scans container images, filesystems, git repositories, virtual machine images, and Kubernetes clusters. It detects OS package vulnerabilities, application dependency issues, IaC misconfigurations, exposed secrets, and software license problems. 32.2k GitHub stars make it the most-starred open-source security scanner on GitHub.
Is Trivy free?
Yes. Trivy is fully free and open-source under the Apache 2.0 license. There are no usage limits or paywalls. Aqua Security maintains the project and offers a separate commercial platform for enterprise features, but the scanner itself is unrestricted.
How does Trivy compare to Checkov and Snyk?
Trivy is a single binary that covers vulnerabilities, IaC misconfigurations, secrets, and licenses in one tool. Checkov focuses specifically on IaC misconfiguration scanning with a larger policy library for that use case. Snyk offers fix suggestions and a curated vulnerability database but requires a paid plan for team features.
How do you integrate Trivy into CI/CD?
Trivy runs as a standalone CLI. Add it to any pipeline with a single command. It has an official GitHub Action (aquasecurity/trivy-action), plus pre-built integrations for GitLab CI, CircleCI, and Jenkins. Exit codes let you fail builds when severity thresholds are exceeded. SARIF output integrates with GitHub Code Scanning.
What happened to tfsec?
tfsec was merged into Trivy. All tfsec checks are now available in Trivy’s misconfiguration scanner. The tfsec repository directs users to Trivy. Running trivy config on Terraform files applies the same checks that tfsec used to run standalone.