Interview Prep/Docker/Security and scanning

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.

All Docker questions Roadmap: Docker & containers

More on Security and scanning