Interview Prep/Docker/Image Security & Hardening

How do you scan an image with Trivy and fail a CI build on serious findings?

BeginnerProductionImage Security & Hardening
Answer
trivy image --severity HIGH,CRITICAL --exit-code 1 --ignore-unfixed registry.example.com/app:1.4.2

--exit-code 1 fails the pipeline, --ignore-unfixed avoids blocking on CVEs with no patch. Scan the image you will deploy (by digest), not just the Dockerfile, and also run trivy config . for Dockerfile/IaC misconfigurations.

All Docker questions Roadmap: Docker & containers

More on Image Security & Hardening