The socket is root, and what :ro does
Through the socket you can start a container with any volumes, including the host’s root. So a service with socket access is a service with root on the server. Everything else gets no socket at all.
:ro in - /var/run/docker.sock:/var/run/docker.sock:ro protects the socket file itself, not the API: you can
still connect to the socket and send any command: the mount flag stops changes to the file, while writing to a socket is talking to dockerd, which :ro doesn’t touch. Only a proxy in front of the socket that lets
through allowed endpoints can limit the API requests themselves.
Who needs write access for real
Tools that manage Docker (Dockhand, Portainer) need full access by design. Keep them stopped while you don’t need them, and put them behind a password and CrowdSec.
How to check
Who has the socket mounted right now:
docker ps -q | xargs docker inspect --format '{{.Name}} {{range .Mounts}}{{.Source}} {{end}}' | grep docker.sock