Interview Prep/DevSecOps/Container and IaC Security

`trivy image` shows 300 vulnerabilities in your app image. How do you bring this down?

BeginnerScenarioContainer and IaC Security
Answer

Situation read → Most findings come from the OS layer and unused packages, not your code.

What I'd do →

  1. Group by layer and package: trivy image --format table app:1.0.
  2. Switch to a smaller, regularly rebuilt base image.
  3. Remove packages you do not need (apt-get purge, no curl/wget in final image).
  4. Rebuild weekly to pick up base image patches.
  5. Filter on actionable items: --severity HIGH,CRITICAL --ignore-unfixed.

Why → One base image switch often removes 80% of findings.

Interview tip → Say you prioritise fixable and exploitable findings, not raw counts.

All DevSecOps questions Roadmap: Policy as code

More on Container and IaC Security