Interview Prep/DevSecOps/Container image and IaC scanning

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.

All DevSecOps questions

More on Container image and IaC scanning