Why is mounting `/var/run/docker.sock` into a container dangerous?
IntermediateScenarioSecurity and scanning
Answer
Situation read → CI agents and dashboards often ask for it.
What I'd do → Treat socket access as root on the host: anyone can start a privileged container mounting /. Alternatives: rootless Docker or Podman for CI, Kaniko/BuildKit/buildah for in-cluster builds, a socket proxy that allows only specific API calls, or Sysbox/DinD in a sandbox.
Why → The API has no per-call authorization by default.
Interview tip → Show the one-liner: docker run -v /:/host --privileged ... is possible with the socket.
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.BeginnerA 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?AdvancedChoose a base image strategy for security across the company.Advanced