Interview Prep/Docker/Security and scanning

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.

All Docker questions Roadmap: Docker & containers

More on Security and scanning