Source: docker-socket-proxy — README by Tecnativa. Adapted synthesis by Hermes (DeepSeek V4 Flash via Zen): key ideas, not a copy.
A security-enhanced proxy for the Docker socket. Mounting the raw socket into a container effectively gives it root access to the host (or the whole swarm); this proxy sits between the socket and the service and blocks every API request you don't explicitly allow.
Official Alpine-based HAProxy image with a small configuration file. Access is controlled by environment variables that match API URL prefixes: 0 revokes, 1 grants; denied requests get HTTP 403 Forbidden.
Granted by default (EVENTS, PING, VERSION): mostly harmless and almost required by any API consumer. Revoked by default: AUTH, SECRETS, and POST — with POST off, the whole API is read-only (only GET/HEAD). Everything else (CONTAINERS, IMAGES, EXEC, NETWORKS, VOLUMES, BUILD, COMMIT, SWARM, NODES, SERVICES, TASKS, INFO, SYSTEM, CONFIGS, DISTRIBUTION, GRPC, PLUGINS, SESSION) is off unless you opt in. Fine-grained actions exist too: ALLOW_START, ALLOW_STOP, ALLOW_RESTARTS, ALLOW_PAUSE, ALLOW_UNPAUSE.
Run the proxy with the socket mounted (--privileged is required in some SELinux/AppArmor contexts), bind its port privately (-p 127.0.0.1:2375:2375 — never expose it publicly), and point the consumer at it (e.g. DOCKER_HOST=tcp://localhost:2375). SOCKET_PATH covers non-standard socket locations (e.g. balenaOS).
Never expose the port to a public network — only to a private Docker network shared with the consumer. Revoke any API section the service doesn't need. No TLS by design: it's plain HTTP because it's meant to be confined to the Docker network. Know the API version in use (1.27 → 1.51 supported). Tags: :latest (last release), :edge (master), :{{version}} per release — GHCR recommended over Docker Hub.
The standard companion for Traefik-style proxies and monitoring agents that need Docker API access without full root. Our VPS already runs Traefik and a restricted docker-agent; docker-socket-proxy is the complementary piece if we ever give other containers socket access with least privilege. Container Security rule of thumb: never mount /var/run/docker.sock directly — gate it behind a filter like this.