Trivy reports secrets in the image: `AWS_SECRET_ACCESS_KEY` found in `/app/.env`
BeginnerTroubleshootingContainer image and IaC scanning
Answer
Likely causes → COPY . . without a .dockerignore copied the local .env into the image.
Diagnose →
trivy image --scanners secret myapp:1.4
docker run --rm --entrypoint ls myapp:1.4 -la /app
Fix → Rotate the key (the image may already be in a registry), add .dockerignore (.env, .git, *.pem), rebuild and delete the old tag/digest from the registry.
Prevent → Secret scanning on images in CI, a template .dockerignore, and runtime secrets via mounted volumes or env from a secret store.
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