Interview Prep/Docker/Security and scanning

Review a Dockerfile: `FROM ubuntu`, `RUN curl ... | bash`, no `USER`. What are your comments?

BeginnerScenarioSecurity and scanning
Answer

Situation read → Several smells.

What I'd do →

  1. Pin base tag/digest, prefer a smaller base.
  2. Do not pipe remote scripts to bash; download, verify checksum, then run.
  3. Add a non-root USER.
  4. Combine layers, clean caches.
  5. Add HEALTHCHECK and .dockerignore; run hadolint.

Why → Unverified downloads are a supply-chain risk.

Interview tip → Lead with the security items, then efficiency.

All Docker questions Roadmap: Docker & containers

More on Security and scanning