Interview Prep/DevSecOps/Container image and IaC scanning

Trivy in an air-gapped runner fails with `failed to download vulnerability DB` even though you copied `db.tar.gz`

AdvancedTroubleshootingContainer image and IaC scanning
Answer

Likely causes → The DB is not extracted into the expected cache layout, metadata is too old, or the Java DB is still being fetched for JAR scanning.

Diagnose →

ls ~/.cache/trivy/db/        # expect trivy.db and metadata.json
cat ~/.cache/trivy/db/metadata.json

Fix →

mkdir -p ~/.cache/trivy/db && tar -xzf db.tar.gz -C ~/.cache/trivy/db
trivy image --skip-db-update --skip-java-db-update --offline-scan myapp:1.4

Prevent → Automate a daily DB export (oras pull ghcr.io/aquasecurity/trivy-db:2) into the internal artifact store and alert when metadata.json UpdatedAt is older than 48 hours.

All DevSecOps questions

More on Container image and IaC scanning