Overview
Trivy is an open-source security scanner that can inspect container images, filesystems, repositories and supported configuration types for vulnerabilities and misconfigurations. It is useful for adding repeatable checks to development and deployment workflows.
Key features
Container and dependency vulnerability scanning; configuration checks; secret detection; CI integration.
Install & first run
# macOS / Linux Homebrew
brew install trivy
# Or the release binary from https://github.com/aquasecurity/trivy/releases
# Debian/Ubuntu also have an official apt repository - see the docs link below
# Docker
docker run --rm aquasec/trivy image alpine:3.20
# Scan a container image
trivy image myapp:latest
# Scan a project directory for vulnerable dependencies and bad config
trivy fs .
# Infrastructure-as-code and secrets in one pass
trivy config . && trivy fs --scanners secret .
The vulnerability database is downloaded on first run and refreshed every 24 hours. Docs: https://trivy.dev/latest/docs/
Real-world example
Scan your own container image before publishing it and review high-severity results alongside base-image and dependency updates.
Common questions
Does a clean Trivy scan prove a container is secure?
No. Coverage depends on the scanned artifact, enabled checks and current vulnerability data.
What does it actually scan?
OS packages, language dependencies from lockfiles, container image layers, IaC manifests, Kubernetes manifests and (opted in) secrets.
Why a 24 hour database refresh?
It downloads the vulnerability DB on first run and caches it. In air-gapped CI, mirror the DB or pass --skip-db-update with a prebuilt cache.
Does it fail my build?
Only with --exit-code 1. Severity thresholds (--severity HIGH,CRITICAL) then define what counts as a failure.
Related tools
Prowler
Audit AWS, Azure, GCP, Kubernetes and Microsoft 365 against hundreds of security checks with read-only access. Free, open source.
Keep exploring: browse every assessment phase in the Pentest Hub.
Authorized testing only — only ever test systems you own or have explicit written permission to assess.
