CI image scan fails with `unable to inspect the image: ... unauthorized: authentication required` for a private ECR repo
BeginnerTroubleshootingContainer image and IaC scanning
Answer
Likely causes → Trivy is not logged in to the registry, or the ECR token (valid 12 hours) expired in a long pipeline.
Diagnose → aws sts get-caller-identity and aws ecr get-login-password | docker login ... result.
Fix →
aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin 123456789012.dkr.ecr.ap-south-1.amazonaws.com
trivy image 123456789012.dkr.ecr.ap-south-1.amazonaws.com/myapp:1.4
Or scan the local image before push.
Prevent → Scan in the build job right after docker build and before docker push.
More on Container image and IaC scanning
Trivy fails the build on 14 HIGH/CRITICAL CVEs in the base image, all with "Fixed Version" emptyBeginner`FATAL ... failed to download vulnerability DB: ... TOOMANYREQUESTS: retry-after` from Trivy in CIIntermediateTrivy in an air-gapped runner fails with `failed to download vulnerability DB` even though you copied `db.tar.gz`AdvancedTrivy and Grype report different CVE counts for the same imageIntermediate`.trivyignore` entries are ignored and the build still fails on the same CVEBeginnerTrivy reports a critical CVE in a Go binary built from your own code, in package `stdlib`Intermediate