A developer asks for `--privileged`. What do you do?
IntermediateScenarioSecurity and scanning
Answer
Situation read → Usually only a few capabilities or devices are needed.
What I'd do → Ask what for. Replace with the narrow need: --cap-add NET_ADMIN, --device /dev/fuse, --cap-add SYS_PTRACE for debugging. For Docker-in-Docker use rootless DinD or Sysbox.
Why → --privileged gives all capabilities, disables seccomp/AppArmor and exposes host devices.
Interview tip → Start from --cap-drop ALL and add back.
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?IntermediateHarden a container run command for a stateless web API.IntermediateA pentester got root inside a container. How bad is it?AdvancedChoose a base image strategy for security across the company.Advanced