What is the risk of mounting `/var/run/docker.sock`, and what do you do instead?
IntermediateProductionImage Security & Hardening
Answer
Access to the socket is equivalent to root on the host: the container can launch a privileged container that mounts /. For CI builds use rootless BuildKit, Buildah, Kaniko-style builders, or Kubernetes-native builders. If something genuinely needs API access (Traefik), put a socket proxy like tecnativa/docker-socket-proxy in front that allows only GET /containers.
More on Image Security & Hardening
Why should containers not run as root, and how do you enforce it?BeginnerWhat is a distroless image and what are the trade-offs?BeginnerHow do you scan an image with Trivy and fail a CI build on serious findings?BeginnerHow do you manage Trivy false positives and accepted risks?IntermediateWhich `docker run` flags make up a hardened runtime baseline?BeginnerWhat does `no-new-privileges` protect against?Beginner