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 →
- Pin base tag/digest, prefer a smaller base.
- Do not pipe remote scripts to bash; download, verify checksum, then run.
- Add a non-root
USER. - Combine layers, clean caches.
- Add
HEALTHCHECKand.dockerignore; runhadolint.
Why → Unverified downloads are a supply-chain risk.
Interview tip → Lead with the security items, then efficiency.
More on Security and scanning
A scan reports 300 CVEs in your base image. How do you triage?IntermediateAdd vulnerability scanning to CI so critical findings block the merge.BeginnerWhy is mounting `/var/run/docker.sock` into a container dangerous?IntermediateA developer asks for `--privileged`. What do you do?IntermediateHarden a container run command for a stateless web API.IntermediateA pentester got root inside a container. How bad is it?Advanced