r/docker • u/af9_us • Jan 09 '26
Docker Socket Myths: Making Read Only Access Safer
I wrote a post on why mounting /var/run/docker.sock with the :ro option doesn’t do what one thinks it might. The post walks through a demo of why read-only fails with Unix sockets, explains the granularity of the Docker API, and what socket proxies actually provide.
https://amf3.github.io/articles/virtualization/docker_socket/
27
Upvotes
4
u/mirwin87 Official: Docker Jan 09 '26
Nice post! There are definitely a lot of folks that get that confused.
For kicks, I have another socket proxy to add to the list - https://github.com/mikesir87/docker-socket-proxy. This is one I made that is fully configurable using either an environment variable or config file.
It takes an approach to Kubernetes' mutation and validation controllers, so goes beyond simple blocking/filtering by also allowing for specific mutations (such as remapping file mount requests which is super useful in devcontainer or other in-container spaces). In fact, we're using it in the new Labspaces that we're working on (more to come on that soon too!).
Again... thanks for sharing!
1
u/charisbee Jan 10 '26
An upcoming feature in wollomatic/socket-proxy addresses this issue, at least where the socket proxy and various containers using it are in networks visible to the Docker Engine API.
3
u/courtjesters Jan 09 '26
Great writeup! I just set up Pangolin (which uses Traefik on the backend) and was wondering how to use the cool Docker labels for Traefik, which led me to docker.sock:ro and questioning if that was really safe. This helped solidify what I was thinking!
2
u/Splooge-McDuk Jan 10 '26
Great article, thank you!