trivy --helpDisplays the main help menu and available subcommands for Trivy.
Aqua’s all-in-one scanner for vulnerabilities, misconfigurations, secrets and licenses in container images, filesystems, repositories, IaC and Kubernetes.
sudo apt install trivytrivy fs [DIRECTORY]Scans the current directory and subdirectories for dependencies and lock files.
Example
trivy fs .trivy fs <path>Modifies scanning target bounds extracting explicit Docker contexts analyzing completely raw explicit standard system source files mapped entirely cleanly across any Linux environment.
Example
trivy fs /opt/projecttrivy repo [REPO_URL]Clones and scans a remote Git repository for vulnerabilities in one step.
Example
trivy repo https://github.com/knqyf263/trivy-ci-testtrivy config [DIRECTORY]Scans Infrastructure as Code (IaC) files like Terraform and Kubernetes manifests for misconfigurations.
Example
trivy config ./k8s-manifeststrivy image --severity [LEVELS] [IMAGE]Filters scan results to show only vulnerabilities matching the specified severity levels.
Example
trivy image --severity HIGH,CRITICAL nginx:latesttrivy image --ignore-unfixed [IMAGE]Hides vulnerabilities that do not yet have a patch or fix available.
Example
trivy image --ignore-unfixed python:3.9trivy image --vuln-type [TYPES] [IMAGE]Restricts the scan to Operating System package vulnerabilities only.
Example
trivy image --vuln-type os debian:bustertrivy image --vuln-type library [IMAGE]Restricts the scan to application dependency vulnerabilities (e.g., npm, pip, gomod).
Example
trivy image --vuln-type library node:14trivy fs --scanners secret [DIRECTORY]Scans the filesystem specifically for hardcoded secrets, keys, and passwords.
Example
trivy fs --scanners secret ./srctrivy fs --scanners license [DIRECTORY]Scans the filesystem to classify and detect software licenses in dependencies.
Example
trivy fs --scanners license ./srctrivy image --scanners vuln,secret,misconfig [IMAGE]Runs vulnerability, secret detection, and misconfiguration scans simultaneously on an image.
Example
trivy image --scanners vuln,secret,misconfig my-app:latesttrivy image --format json --output [FILE] [IMAGE]Outputs the scan results in raw JSON format to a specified file.
Example
trivy image --format json --output result.json alpine:latesttrivy image --format table [IMAGE]Displays scan results in a human-readable table format in the terminal (default).
Example
trivy image --format table alpine:latesttrivy image --format sarif --output [FILE] [IMAGE]Generates a SARIF report suitable for integration with GitHub Security code scanning.
Example
trivy image --format sarif --output results.sarif golang:1.16trivy image --format cyclonedx --output [FILE] [IMAGE]Generates a CycloneDX Software Bill of Materials (SBOM) from a container image.
Example
trivy image --format cyclonedx --output sbom.json node:ltstrivy image --format spdx-json --output [FILE] [IMAGE]Generates an SPDX JSON Software Bill of Materials (SBOM) from a container image.
Example
trivy image --format spdx-json --output sbom.spdx.json python:3.8trivy sbom [FILE]Scans a pre-generated SBOM file for vulnerabilities without re-analyzing the original image.
Example
trivy sbom ./sbom.jsontrivy image --exit-code 1 --severity CRITICAL [IMAGE]Forces the process to exit with code 1 if CRITICAL vulnerabilities are found, breaking the build.
Example
trivy image --exit-code 1 --severity CRITICAL web-app:v1trivy image --exit-code 0 --severity HIGH [IMAGE]Logs HIGH severity vulnerabilities but exits with code 0 to allow the build pipeline to continue.
Example
trivy image --exit-code 0 --severity HIGH web-app:v1trivy image --ignorefile [FILE] [IMAGE]Scans an image while excluding specific vulnerabilities defined in a .trivyignore file.
Example
trivy image --ignorefile .trivyignore alpine:latesttrivy image --offline-scan [IMAGE]Scans using the currently cached database without attempting to reach the internet.
Example
trivy image --offline-scan centos:7trivy image --skip-db-update [IMAGE]Skips the vulnerability database update step to speed up repeated scans.
Example
trivy image --skip-db-update redis:alpinetrivy fs --skip-dirs [DIRS] [PATH]Excludes specified directories from the filesystem scan to reduce noise and time.
Example
trivy fs --skip-dirs node_modules,dist .trivy fs --skip-files [FILES] [PATH]Excludes specific files from being parsed during a filesystem scan.
Example
trivy fs --skip-files package-lock.json .trivy image --input [FILE]Scans a container image exported as a tar archive (e.g., from docker save).
Example
trivy image --input image.tartrivy image [REGISTRY_IMAGE]Scans an image from a private registry using environment variables for authentication.
Example
export TRIVY_USERNAME=user TRIVY_PASSWORD=pass; trivy image private.registry.com/app:v1trivy k8s cluster --report summaryScans the entire connected Kubernetes cluster and outputs a summary report.
trivy k8s --namespace [NS] allScans all resources (pods, deployments, services) within a specific Kubernetes namespace.
Example
trivy k8s --namespace kube-system alltrivy k8s --include-namespaces [NS] clusterRestricts the cluster scan to only the specified namespaces.
Example
trivy k8s --include-namespaces prod,staging clustertrivy k8s resource [KIND]/[NAME]Scans a specific Kubernetes resource type and name found in the active cluster.
Example
trivy k8s resource deployment/nginx-apptrivy aws --region [REGION] --service [SERVICE]Scans AWS S3 bucket configurations in the specified region for security issues.
Example
trivy aws --region us-east-1 --service s3trivy aws --service ec2Scans AWS EC2 instances and security groups for misconfigurations.
trivy aws --arn [ARN]Scans a specific AWS resource identified by its Amazon Resource Name (ARN).
Example
trivy aws --arn arn:aws:s3:::my-buckettrivy vm [IMAGE_FILE]Scans a virtual machine disk image (QCOW2, VMDK, etc.) for OS vulnerabilities.
Example
trivy vm disk.qcow2trivy image --list-all-pkgs [IMAGE]Outputs all detected packages in the image, regardless of whether they have vulnerabilities.
Example
trivy image --list-all-pkgs ubuntu:20.04trivy image --format template --template "@[PATH]" [IMAGE]Generates a report using a custom Go template (e.g., HTML) for visualization.
Example
trivy image --format template --template "@contrib/html.tpl" -o report.html alpinetrivy config --policy [DIR] [TARGET]Applies custom Rego policies located in a directory to the configuration scan.
Example
trivy config --policy ./policies ./terraformtrivy config --policy-namespaces [NS] [TARGET]Restricts custom policy evaluation to specific Rego namespaces.
Example
trivy config --policy-namespaces user.kubernetes .trivy rootfs [DIR]Scans an unpacked root filesystem directly, often used for host OS scanning.
Example
trivy rootfs /mnt/host-roottrivy server --listen [ADDRESS]Starts Trivy in server mode to handle scan requests from remote clients.
Example
trivy server --listen 0.0.0.0:8080trivy client --remote [URL] [IMAGE]Sends a scan request to a remote Trivy server instead of using a local database.
Example
trivy client --remote http://localhost:8080 alpine:latesttrivy client --token [TOKEN] --remote [URL] [IMAGE]Connects to a protected Trivy server using a token header for authentication.
Example
trivy client --token MySecretToken --remote http://localhost:8080 alpinedocker run aquasec/trivy [COMMAND]Runs Trivy itself inside a Docker container, mounting the host's Docker socket to scan sibling containers.
Example
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock aquasec/trivy image python:3trivy image --history [IMAGE]Analyzes the build history of the container image to associate vulnerabilities with specific layers.
Example
trivy image --history my-app:latesttrivy k8s --compliance [STANDARD] --report summaryScans the Kubernetes cluster against a specific compliance standard like NSA or CIS.
Example
trivy k8s --compliance nsa --report summarytrivy image --insecure [IMAGE]Allows scanning images from a registry that uses self-signed SSL certificates or HTTP.
Example
trivy image --insecure internal-registry.local/image:tagtrivy image --timeout [DURATION] [IMAGE]Sets a custom timeout duration for the scan operation to prevent hanging in pipelines.
Example
trivy image --timeout 15m node:latesttrivy image --download-java-db-onlyDownloads only the Java index database used for scanning JAR/WAR files.
trivy fs --secret-config [FILE] [DIR]Uses a custom configuration file to define regex patterns for secret detection.
Example
trivy fs --secret-config trivy-secret.yaml .trivy image --quiet [IMAGE]Suppresses the progress bar and log messages, outputting only the final report.
Example
trivy image --quiet alpine:latesttrivy config [CHART_DIR]Scans Helm chart templates for security misconfigurations and best practice violations.
Example
trivy config ./my-helm-charttrivy config [TEMPLATE_FILE]Scans AWS CloudFormation templates for infrastructure security risks.
Example
trivy config template.yamltrivy image --db-repository [URL] [IMAGE]Specifies a custom OCI registry URL to download the vulnerability database from.
Example
trivy image --db-repository ghcr.io/aquasecurity/trivy-db alpinetrivy image --rekor-url [URL] [IMAGE]Verifies the image attestation against a specified Rekor transparency log server.
Example
trivy image --rekor-url https://rekor.sigstore.dev alpinetrivy image --vex [FILE] [IMAGE]Uses a VEX (Vulnerability Exploitability Exchange) file to filter out non-exploitable vulnerabilities.
Example
trivy image --vex openvex.json alpinetrivy fs --scanners vuln [GO_PROJECT]Scans a Go project directory, parsing go.mod and go.sum for dependency vulnerabilities.
Example
trivy fs --scanners vuln ./go-apptrivy fs [PYTHON_PROJECT]Scans a Python project, identifying vulnerabilities in requirements.txt, Pipfile.lock, or poetry.lock.
Example
trivy fs ./python-apptrivy image --cache-dir [DIR] [IMAGE]Specifies a custom directory for storing the vulnerability database and artifact cache.
Example
trivy image --cache-dir /tmp/trivy-cache alpinetrivy image --input [TAR] --format jsonScans a tarballed Docker image and outputs JSON, useful for air-gapped pipeline stages.
Example
trivy image --input app.tar --format json -o analysis.jsontrivy image --debug [IMAGE]Runs the scan with verbose debug logging to troubleshoot detection or network issues.
Example
trivy image --debug alpinetrivy repo --branch [BRANCH] [URL]Scans a specific branch of a remote Git repository instead of the default branch.
Example
trivy repo --branch develop https://github.com/org/repotrivy repo --commit [HASH] [URL]Scans a specific commit hash within a remote Git repository.
Example
trivy repo --commit 8f9d12a https://github.com/org/repotrivy k8s --context [CTX] clusterSpecifies which kubeconfig context to use when scanning a Kubernetes cluster.
Example
trivy k8s --context production-cluster clustertrivy image --dependency-tree [IMAGE]Displays the hierarchy of dependencies to show which root package brought in a vulnerability.
Example
trivy image --dependency-tree node:alpinetrivy k8s --parallel [N] clusterSets the number of concurrent scan jobs when scanning Kubernetes resources to improve speed.
Example
trivy k8s --parallel 5 clustertrivy config --include-non-failures [DIR]Reports all configuration checks, including those that passed, for audit purposes.
Example
trivy config --include-non-failures .trivy image --refresh [IMAGE]Forces a refresh of the cached layer information for the image before scanning.
Example
trivy image --refresh alpinetrivy config --check-namespaces [NS] [DIR]Runs only specific Rego checks from a given namespace against the configuration.
Example
trivy config --check-namespaces appshield .trivy image --ignore-status [STATUS] [IMAGE]Ignores vulnerabilities that have a specific status in the vulnerability database.
Example
trivy image --ignore-status fixed alpinetrivy image --platform [PLATFORM] [IMAGE]Scans the image architecture variant specifically for ARM64 or other platforms.
Example
trivy image --platform linux/arm64 python:3.9trivy plugin install [URL]Installs a Trivy plugin from a Git repository to extend functionality.
Example
trivy plugin install github.com/aquasecurity/trivy-plugin-kubectltrivy [PLUGIN_NAME] [ARGS]Executes an installed plugin command, such as the kubectl plugin for pod scanning.
Example
trivy kubectl pod my-podtrivy image --sbom-sources [SOURCE] [IMAGE]Retrieves the SBOM from a signing transparency log (Rekor) rather than generating it.
Example
trivy image --sbom-sources rekor alpinetrivy image --cache-backend redis://[HOST]Uses a Redis instance as the cache backend instead of the local filesystem for distributed scanning.
Example
trivy image --cache-backend redis://localhost:6379 alpinetrivy image --severity HIGH,CRITICAL --ignore-unfixed --vuln-type os [IMAGE]Combines multiple filters to find only fixable, high-risk OS vulnerabilities.
Example
trivy image --severity HIGH,CRITICAL --ignore-unfixed --vuln-type os centos:7trivy azure --service [SERVICE]Scans Azure Blob Storage configurations for public access risks (experimental/preview).
Example
export AZURE_AUTH_LOCATION=auth.json; trivy azure --service blobtrivy google --project [PROJECT]Scans Google Cloud Platform resources within a specific project for misconfigurations (experimental).
Example
trivy google --project my-gcp-projecttrivy vm --scanners vuln [SNAPSHOT_ID]Scans an AWS EBS snapshot directly by mounting it securely (requires proper IAM permissions).
Example
trivy vm --scanners vuln snap-12345678trivy image --format template --template "@contrib/html.tpl" --output report.html [IMAGE]Generates a visual HTML report using the contrib template for stakeholder presentation.
Example
trivy image --format template --template "@contrib/html.tpl" --output report.html nginxtrivy image --format template --template "@contrib/junit.tpl" --output junit.xml [IMAGE]Generates a JUnit XML report for parsing by CI systems like Jenkins or GitLab.
Example
trivy image --format template --template "@contrib/junit.tpl" --output junit.xml nginxtrivy config --helm-values [FILE] [CHART]Scans a Helm chart while applying a specific values.yaml file to render the templates accurately.
Example
trivy config --helm-values prod-values.yaml ./my-charttrivy config --tf-vars [FILE] [DIR]Scans Terraform code while applying variables from a tfvars file to resolve dynamic blocks.
Example
trivy config --tf-vars prod.tfvars ./terraformtrivy image --no-progress --format template --template "@contrib/gitlab.tpl" -o gl-container-scanning-report.json [IMAGE]Generates a JSON report formatted specifically for GitLab's Container Scanning dashboard integration.
Example
trivy image --no-progress --format template --template "@contrib/gitlab.tpl" -o gl-container-scanning-report.json app:latesttrivy image --diff-id [ID1] --diff-id [ID2]Compares two scans by Image ID to identify new vulnerabilities introduced between versions.
Example
trivy image --diff-id sha256:old --diff-id sha256:newtrivy image --registry-token [TOKEN] [IMAGE]Uses a bearer token directly for registry authentication instead of username/password.
Example
trivy image --registry-token $REGISTRY_TOKEN private.io/image:tagtrivy config --data [DIR] [TARGET]Passes external data files (JSON/YAML) to Rego policies for context-aware configuration scanning.
Example
trivy config --data ./rego-data ./k8strivy image --removed-pkgs [IMAGE]Detects vulnerabilities in packages that were removed but might still leave artifacts or traces.
Example
trivy image --removed-pkgs alpine:latesttrivy image [DISTROLESS_IMAGE]Scans Google Distroless images by analyzing the /var/lib/dpkg/status file or binary headers.
Example
trivy image gcr.io/distroless/static:nonroottar -cf db.tar db/ && trivy image --cache-dir . --offline-scan [IMAGE]Simulates an air-gapped workflow where the DB is manually transported and used for offline scanning.
Example
tar -cf db.tar db/ && trivy image --cache-dir . --offline-scan alpinetrivy k8s --compliance k8s-cis-1.23 --report summaryChecks the cluster specifically against the CIS Kubernetes Benchmark v1.23.
trivy image --exit-on-eol [INT] [IMAGE]Exits with a specific error code if the OS version of the image has reached End of Life (EOL).
Example
trivy image --exit-on-eol 1 python:2.7trivy --config [CONFIG_YAML] image [IMAGE]Runs a scan using global parameters (cache, timeout, format) defined in a YAML configuration file.
Example
trivy --config trivy.yaml image alpinetrivy image --exit-code 1 --severity CRITICAL --no-progress --format sarif -o report.sarif [IMAGE]A complete pipeline command: checks criticals, fails build on hit, stays silent, and saves SARIF artifacts.
Example
trivy image --exit-code 1 --severity CRITICAL --no-progress --format sarif -o report.sarif my-app:build-123trivy image <image>Processes explicit multi-layered localized dependencies systematically executing heavily updated internal algorithms checking actively vulnerable libraries physically inside the OCI map.
Example
trivy image target:latesttrivy image --security-checks vuln,secret,config <image>Broadens aggressively limited explicit arrays completely indexing deeply integrated logic actively unmasking hardcoded passwords locally bridging systemic Dockerfile misconfigurations.
Example
trivy image --security-checks vuln,secret,config app:v1trivy image --severity HIGH,CRITICAL <image>Replaces standard tracking output inherently silencing unmitigated non-patchable trivial bugs strictly inherently exposing completely unmitigated massively destructive unpatched flaws.
Example
trivy image --severity HIGH,CRITICAL apptrivy aws --region <region>Alters API integration natively hooking directly entirely across localized authenticated extremely explicit inherent AWS architecture environments exposing highly misconfigured resources globally.
Example
trivy aws --region us-east-1trivy k8s --report summary <type>Navigates entirely across inherently deeply massive internal native K8S clusters completely profiling absolutely explicit running pods mapping heavily integrated inherent system failures.
Example
trivy k8s --report summary clustertrivy image --format spdx-json -o <file> <image>Aggregates massive deep software package matrices perfectly encoding entirely locally natively to strict absolute SPDX specifications fundamentally tracking explicitly supply chain integrations.
Example
trivy image --format spdx-json -o sbom.json app:v1trivy image --ignore-unfixed <image>Suppresses inherently incredibly aggressive matching loops actively disabling heavily documented explicit bugs cleanly validating natively exactly instances where patches formally physically exist.
Example
trivy image --ignore-unfixed target:latesttrivy image --clear-cacheObiterates deeply compiled immensely massive local historic configuration states manually fundamentally overriding natively deeply corrupted extraction database arrays.
trivy client --remote <url> <image>Bridges unauthenticated explicitly limited inherent container operations effectively entirely deferring complex parsing actively targeting centralized massive extremely high-power analytical infrastructures.
Example
trivy client --remote http://trivy-server:4954 apptrivy config <path>Unlinks CVE dependencies completely tracking entirely explicit misconfigurations deeply hardcoded internally strictly inside Terraform, CloudFormation, or Dockerfile manifest bounds.
Example
trivy config ./terraform-infrastructuretrivy repository <url>Fundamentally clones extremely massive completely remote public organizational git mappings dynamically executing exhaustive pipeline scanning locally devoid entirely of containers.
Example
trivy repository https://github.com/org/vulnerable-repotrivy image --offline-scanAggressively restricts all outgoing network loops systematically enforcing internal offline validations perfectly resolving issues entirely isolating tracking algorithms dynamically.
Example
trivy image --offline-scan myapp:v1trivy plugin install <plugin>Modifies internal functionality extending systemic analysis bridges strictly loading dynamic external plugins expanding Trivy's innate explicit runtime reporting modules natively.
Example
trivy plugin install github.com/aquasecurity/trivy-plugin-aquatrivy image -o <file.html> --template <path>Bridges fundamental GO templating logic explicitly tracking incredibly massive native CVE responses and perfectly generating absolutely clean heavily styled HTML reports.
Example
trivy image -f template --template "@contrib/html.tpl" -o report.html appAnchore’s vulnerability scanner for container images and filesystems; pairs naturally with Syft SBOMs.
Generates a software bill of materials (SBOM) from container images and filesystems in SPDX, CycloneDX and other formats.
An open-source service for static analysis of vulnerabilities in container images, typically used with registries via clairctl.
The Docker CLI: build, run and inspect containers and images, and audit their configuration, mounts, capabilities and networks.
A script that checks a Docker host against dozens of CIS Docker Benchmark best practices for production deployments.