Interview Prep/DevSecOps/Container and IaC Security

A team asks whether to use `ubuntu`, `alpine` or a distroless base image. How do you advise?

BeginnerScenarioContainer and IaC Security
Answer

Situation read → Fewer packages means fewer CVEs and less attacker tooling, but also harder debugging.

What I'd do →

  1. Recommend distroless or a minimal Chainguard/Wolfi-style image for production services in compiled languages.
  2. Use Alpine when the team needs a shell and a package manager, and accept musl compatibility quirks.
  3. Use Ubuntu or Debian slim only when software needs glibc and many system libraries.
  4. Pair with multi-stage builds so compilers never reach the runtime image.
  5. Debug with kubectl debug ephemeral containers instead of baking in a shell.

Why → Attack surface scales with the number of installed packages.

Interview tip → Mention that smaller does not mean automatically patched; you still rescan.

All DevSecOps questions Roadmap: Policy as code

More on Container and IaC Security