Secret deleted in a later Dockerfile `RUN rm` step still shows up in the image scan
IntermediateTroubleshootingContainer image and IaC scanning
Answer
Likely causes → Each layer is immutable; the file exists in the earlier layer even if a later layer deletes it.
Diagnose →
docker history --no-trunc myapp:1.4
dive myapp:1.4
Fix → Use BuildKit secret mounts so the secret never lands in a layer:
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc npm ci
docker build --secret id=npmrc,src=$HOME/.npmrc . Then rotate the exposed token.
Prevent → Ban ARG/ENV for credentials in the Dockerfile linter policy.
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