Trivy
Trivy is a comprehensive scanner for vulnerabilities, misconfigurations and secrets in container images, file systems, git repositories and infrastructure-as-code.
Legal & ethical use. Use this tool only on systems, networks and data that you own or have explicit written permission to test. Unauthorised access or scanning can break computer-misuse laws (for example Pakistan's Prevention of Electronic Crimes Act, 2016, and equivalents elsewhere). Practise in your own lab or in authorised environments such as CTFs.
What it is used for
- Scan an image before deployment
- Check Terraform or Kubernetes files for misconfigurations
Key features
- Image, filesystem and repo scanning
- IaC misconfiguration checks
- SBOM generation
Installation
See trivy.dev for packages, Homebrew, Docker image and install script.
Beginner usage guide
Scan a base image you use and compare results after updating to a newer tag.
Example commands
Run these only against your own lab or authorised targets. Placeholder addresses such as 192.0.2.x are documentation ranges.
Scan an image
trivy image alpine:latestDownloads the vulnerability database on first run and lists known CVEs.
Scan IaC configuration
trivy config ./terraformChecks configuration files for misconfigurations.
References
Source verification
Last reviewed: 2026-10-27
Links checked over HTTP: 2026-10-27 07:51 UTC — official: 200, docs: 200, repo: 200
Commands were written from the official documentation and have not been executed on this site; test them in your lab.
