Interview Prep/DevSecOps/Container and IaC Security

What does Hadolint do and how do you use it in a pipeline?

BeginnerScenarioContainer and IaC Security
Answer

Situation read → Hadolint lints Dockerfiles for bad practices, and embeds ShellCheck for RUN lines.

What I'd do →

  1. Run locally or in CI: hadolint Dockerfile or docker run --rm -i hadolint/hadolint < Dockerfile.
  2. Fail on warnings and above: hadolint --failure-threshold warning Dockerfile.
  3. Store exceptions in .hadolint.yaml with comments.
  4. Typical catches: missing USER (DL3002), unpinned versions (DL3008), ADD instead of COPY (DL3020).

Why → It is fast and catches issues before the image is even built.

Interview tip → Pair it with image scanning; they find different problems.

All DevSecOps questions Roadmap: Policy as code

More on Container and IaC Security