Updated Jul 15, 2026

Containers

Scan container images for CVEs and secrets

Trivy against container images for CVEs, secrets, and misconfigs.

Agent

overview

What trivy-image-scan does

trivy-image-scan takes an image-list file and runs Aqua Trivy against each reference. It unpacks layers and reports OS and library CVEs, with optional secret, config, and license checks via --security-checks.

Operators set --severity to focus the report, --ignore-unfixed to drop unpatched noise, and --exit-code to fail a pipeline when findings cross the threshold. --format covers table, json, sarif, cyclonedx, and spdx.

Use it for any registry or local list. Prefer trivy-ecr-scan when images live in Amazon ECR and you want AWS login handled. Trickest runs it as a managed Containers node that writes a results folder.

source github.com/aquasecurity/trivy

use cases

Where trivy-image-scan fits

Scan images for OS and library CVEs

Read an image list and report vulnerabilities in both system packages and application dependencies, so the full software stack in each image gets checked.

Catch secrets and misconfigurations

Extend security checks to secret and config scanning so credentials baked into a layer or insecure settings surface in the same run as the CVEs.

Generate an SBOM

Emit CycloneDX or SPDX output so a scan doubles as a software bill of materials for supply-chain inventory and compliance.

Gate a build on severity

Filter to high and critical and set an exit code so a pipeline fails when a serious issue appears, blocking a risky image from shipping.

reference

trivy-image-scan inputs and flags

54 inputs
NameTypeFlagDescription
image-listFILE·List of images, line by line, to scan.
severitySTRING--severitySeverities to display (default UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL).
formatSTRING--formatOutput format: table, json, sarif, cyclonedx, spdx, and more (default table).
security-checksSTRING--security-checksIssues to detect: vuln, config, secret, license (default vuln,secret).
vuln-typeSTRING--vuln-typeVulnerability types to scan: os, library.
ignore-unfixedBOOLEAN--ignore-unfixedDisplay only vulnerabilities that have a fix available.
exit-codeSTRING--exit-codeExit code to return when vulnerabilities are found.
ignorefileFILE--ignorefilePath to a .trivyignore file for exceptions (default .trivyignore).

Showing key inputs. trivy-image-scan exposes 54 inputs in total.

Full flag reference (54 inputs)
NameTypeFlagDescription
debugBOOLEAN--debugdebug mode
quietBOOLEAN--quietsuppress progress bar and log output
resetBOOLEAN--resetremove all caches and database
tokenSTRING--tokenfor authentication in client/server mode
traceBOOLEAN--traceenable more verbose trace output for custom queries
configFILE--configconfig path (default "trivy.yaml")
formatSTRING--formatformat (table, json, sarif, template, cyclonedx, spdx, spdx-json, github, cosign-vuln) (default "table")
serverSTRING--serverserver address in client mode
tf-varsSTRING--tf-varsspecify paths to override the Terraform tfvars files
timeoutSTRING--timeouttimeout (default: 5m0s)
helm-setSTRING--helm-setspecify Helm values (can separate values with commas: key1=val1,key2=val2)
insecureBOOLEAN--insecureallow insecure server connections when using TLS
platformSTRING--platformset platform in the form os/arch if image is multi-platform capable
redis-caFILE--redis-caredis ca file location, if using redis as cache backend
severitySTRING--severityseverities of vulnerabilities to be displayed (comma separated) (default: "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL")
templateFILE--templateoutput template
cache-ttlSTRING--cache-ttlcache TTL when using redis as cache backend
exit-codeSTRING--exit-codeExit code when vulnerabilities are found
redis-keyFILE--redis-keyredis key file location, if using redis as cache backend
rekor-urlSTRING--rekor-url[EXPERIMENTAL] address of rekor STL server (default "https://rekor.sigstore.dev")
skip-dirsSTRING--skip-dirsspecify the directories where the traversal is skipped
vuln-typeSTRING--vuln-typecomma-separated list of vulnerability types (os,library)
complianceSTRING--compliancecomma-separated list of what compliance reports to generate (nsa)
ignorefileFILE--ignorefilespecify .trivyignore file (default ".trivyignore")
image-listFILE·List of images line by line to be scanned
redis-certFILE--redis-certredis certificate file location, if using redis as cache backend
skip-filesSTRING--skip-filesspecify the file paths to skip traversal
clear-cacheBOOLEAN--clear-cacheclear image caches without scanning
config-dataFOLDER--config-dataspecify paths from which data for the Rego policies will be recursively loaded
helm-valuesFILE--helm-valuesspecify paths to override the Helm values.yaml files
license-fullBOOLEAN--license-fulleagerly look for licenses in source code headers and license files
offline-scanBOOLEAN--offline-scando not issue API requests to identify dependencies
removed-pkgsBOOLEAN--removed-pkgsdetect vulnerabilities of removed packages (only for Alpine)
sbom-sourcesSTRING--sbom-sources[EXPERIMENTAL] try to retrieve SBOM from the specified sources (rekor)
token-headerSTRING--token-headerspecify a header name for token in client/server mode (default "Trivy-Token")
cache-backendSTRING--cache-backendcache backend (e.g. redis://localhost:6379) (default "fs")
config-policyFOLDER--config-policyspecify paths to the Rego policy files directory, applying config files
db-repositorySTRING--db-repositoryOCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
file-patternsFILE--file-patternsspecify config file patterns
ignore-policyFILE--ignore-policyspecify the Rego file to evaluate each vulnerability
list-all-pkgsBOOLEAN--list-all-pkgsenabling the option will output all packages regardless of vulnerability
secret-configFILE--secret-configspecify a path to config file for secret scanning (default "trivy-secret.yaml")
show-progressBOOLEAN--no-progresssuppress progress bar
custom-headersSTRING--custom-headerscustom headers in client mode
ignore-unfixedBOOLEAN--ignore-unfixeddisplay only fixed vulnerabilities
skip-db-updateBOOLEAN--skip-db-updateskip updating vulnerability database
dependency-treeBOOLEAN--dependency-tree[EXPERIMENTAL] show dependency origin tree of vulnerable packages
helm-set-stringSTRING--helm-set-stringspecify Helm string values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
security-checksSTRING--security-checkscomma-separated list of what security issues to detect (vuln,config,secret,license) (default [vuln,secret])
download-db-onlyBOOLEAN--download-db-onlydownload/update vulnerability database but don't run a scan
ignored-licensesSTRING--ignored-licensesspecify a list of license to ignore
policy-namespacesSTRING--policy-namespacesRego namespaces
username-passwordFILE·Username and password for Docker Hub registry (format username:password)
include-non-failuresBOOLEAN--include-non-failuresinclude successes and exceptions, available with '--security-checks config'

example

Run trivy-image-scan

trivy-image-scan · command
# JSON report of fixable HIGH/CRITICAL CVEs for images in a listtrivy image --severity HIGH,CRITICAL --ignore-unfixed --format json --security-checks vuln,secret --exit-code 1 example/api:1.2.3
sample output
example/api:1.2.3 (alpine 3.18.4)==============================Total: 3 (HIGH: 2, CRITICAL: 1) Library       Vulnerability   Severity  Status  Installed Version  Fixed Versionopenssl       CVE-2023-0286   CRITICAL  fixed   3.1.1-r1           3.1.2-r0curl          CVE-2023-38545  HIGH      fixed   8.2.1-r0           8.4.0-r0libcrypto3    CVE-2023-5363   HIGH      fixed   3.1.1-r1           3.1.3-r0

guidance

Choosing trivy-image-scan

Use when you need Trivy on container images from any registry or a local list, including secrets, misconfigs, licenses, and SBOM output. Prefer trivy-ecr-scan for Amazon ECR with login handled.

trivy-ecr-scan

Same Trivy engine with ECR login built in. Prefer when images live in Amazon ECR.

grype

Another container vulnerability scanner. Different database and output shape, similar role.

trivy-image-scan-sarif

Trivy variant pinned to SARIF for code-scanning ingestion.

faq

trivy-image-scan questions

OS and library vulnerabilities by default. Extend --security-checks to secret, config, and license for a broader supply-chain pass.

Run trivy-image-scan yourself

An image list feeds trivy-image-scan, which inspects each image for CVEs, secrets, and misconfigurations and writes the findings as an output.

Facts on this page come from the live Trickest tool library.