Who this is for: Teams running a remote Docker daemon or Swarm cluster (e.g. an HA active/standby pair) that want to proxy the Docker API over mTLS with automatic failover, without exposing the raw TCP endpoint to downstream tools.
What's exposed: A unix socket shared via a named volume. The downstream docker-cli container connects to /var/run/sockguard/sockguard.sock using DOCKER_HOST. Sockguard dials the remote daemon over TCP+TLS; downstream tools never see the remote endpoint or its credentials.
| Control | Status |
|---|---|
sockguard: read_only, cap_drop: ALL, no-new-privileges |
Enabled |
| Remote daemon credentials (certs) never reach downstream containers | Yes — certs mounted into sockguard only |
| Exec denied | Yes |
| Build denied | Yes |
| Raw log/archive streams denied | Yes — no GET /containers/*/logs or /export rules |
| mTLS to remote daemon | Yes — ca/cert/key required in ./certs/ |
| Failover to standby on health failure | Yes — health_interval: 5s, health_timeout: 2s |
The upstream.endpoints list is an ordered active/passive failover set, not a load balancer. Sockguard picks the first healthy endpoint and only promotes the next one when the active endpoint fails its health check. Both endpoints must be the same logical Docker daemon or Swarm cluster (e.g. an HA pair sharing storage). Routing the same client across two independent daemons would break container ID references, exec sessions, and owner-label isolation.
-
Drop your TLS certificates into
./certs/:ca.pem— CA that signed the daemon's server certcert.pem— client cert (must be trusted by the daemon)key.pem— private key for the client cert
-
Replace
dockerd-primaryanddockerd-standbyinsockguard.yamlwith real hostnames or IP addresses. -
Start the stack:
docker compose up -d- Exec into the
docker-clicontainer to verify connectivity:
docker compose exec docker-cli docker info
docker compose exec docker-cli docker psSockguard logs (format: json) appear under the sockguard service. The /health endpoint is available inside the stack at http://sockguard/health for external liveness probes.