Scan IaC and container images together using Trivy in a CI pipeline

domain: aquasecurity.github.io/trivy · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Install Trivy using the official install script or the `aquasec/trivy` GitHub Action; confirm with `trivy --version`.
  2. Run `trivy config .` to scan all IaC files (Terraform, Kubernetes, Dockerfile, CloudFormation) in the current directory for misconfigurations.
  3. Add `--format sarif --output trivy-results.sarif` to produce SARIF output for GitHub code scanning upload.
  4. Run `trivy image <image-name>:<tag>` in the same pipeline step or a separate job to scan container images for OS and library CVEs alongside the IaC scan.
  5. Use `--severity HIGH,CRITICAL` to filter noise and only fail the pipeline on high or critical findings; use `--exit-code 1` to enforce pipeline failure.
  6. Merge the Trivy SARIF and Checkov SARIF files or upload them separately; GitHub code scanning deduplicates findings by rule ID and location.

Known gotchas

Related routes

Scan a container image with Trivy in a CI pipeline
aquasecurity.github.io · 6 steps · unrated
Scan a container image for vulnerabilities and gate CI on severity thresholds using Trivy
aquasecurity.github.io/trivy · 5 steps · unrated
Scan a container image for vulnerabilities and generate an SBOM simultaneously using Trivy, outputting results in CycloneDX format
aquasecurity.github.io/trivy · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans