Interview Prep/Docker/Image Security & Hardening

How do you find leaked secrets in images?

IntermediateProductionImage Security & Hardening
Answer
trivy image --scanners secret app:1.4.2
docker history --no-trunc app:1.4.2 | grep -iE 'password|token|key'

Also run gitleaks/trufflehog on the repo and context. If one leaked, rotating the secret is mandatory; deleting the layer or tag does not help because registries and caches may keep the blob.

All Docker questions Roadmap: Docker & containers

More on Image Security & Hardening