Interview Prep/DevSecOps/Container image and IaC scanning

`FATAL ... failed to download vulnerability DB: ... TOOMANYREQUESTS: retry-after` from Trivy in CI

IntermediateTroubleshootingContainer image and IaC scanning
Answer

Likely causes → Every job pulls the DB from ghcr.io/aquasecurity/trivy-db anonymously and hits GHCR rate limits, especially behind a shared NAT IP.

Diagnose → Error appears in the DB download phase; count how many parallel jobs start Trivy at once.

Fix → Use a mirror and cache:

trivy image --db-repository public.ecr.aws/aquasecurity/trivy-db:2 \
  --java-db-repository public.ecr.aws/aquasecurity/trivy-java-db:1 \
  --cache-dir .trivycache myapp:1.4

Cache .trivycache between runs (actions/cache keyed by date).

Prevent → Mirror the DB into your own registry with a scheduled job (oras copy), point all jobs at it, and run PR scans with --skip-db-update against the cached copy.

All DevSecOps questions

More on Container image and IaC scanning