
Docker Socket
Proxy
Control what gets through. Filter Docker API requests by method, path, and request body with default-deny posture — then layer on signed policy bundles, per-profile rollout modes for staged enforcement, rate limits and concurrency caps, hot-reload with an admin API, Prometheus metrics, and drop-in Tecnativa compatibility.
See it work
A looping recreation of the real CLI — inspect a config, dry-run a single request through the rules, and watch the proxy stream access logs.
A hand-rendered recreation of the real CLI — every frame mirrors what sockguard actually prints. Use the controls above to pause, restart, or change speed.
Features
Default-deny Docker socket proxy — a lean Go binary with a stdlib request hot path
Default-Deny Posture
SecurityEverything blocked unless explicitly allowed. Request paths are percent-decoded and canonicalized before matching, so `%2e%2e` and encoded-separator tricks cannot slip past an allowlist.
Request Body Inspection
SecurityContainer, image, build, volume, network, secret, config, service, swarm, node, and plugin writes are parsed to block privileged or host-namespace workloads, non-allowlisted mounts/devices, device requests, device cgroup rules, commands, remotes, unsafe network/swarm/node controls, archive writes, and tar imports. Multipart plugin uploads are inspected too, and oversized bounded bodies are rejected with 413 before the inspector runs.
mTLS for Remote TCP
SecurityNon-loopback TCP listeners require mutual TLS 1.3 by default. Plaintext remote TCP is explicit legacy opt-in only.
Owner Label Isolation
ControlStamp label-capable creates, node/swarm claim updates, and build images with an owner label. Labeled list, prune, and event reads are auto-filtered, and cross-owner access is denied across workload and control-plane resources.
Client ACL Primitives
ControlGate callers by source CIDR, bridge-network container labels, mTLS certificate selectors (CN, DNS/IP/URI SAN, SHA-256 SPKI pin), and unix peer credentials before the global policy runs.
Granular Control
ControlAllow start/stop while blocking create/exec. Per-operation POST controls with glob matching.
Structured Access Logging
OperationsJSON access logs with method, raw and normalized paths, decision, matched rule index, latency, canonical request_id, preserved client request IDs, and W3C trace correlation fields.
Operator Observability
OperationsOpt-in Prometheus metrics expose request totals, deny counts, latency buckets, active requests, watchdog state, plus build_info and start_time gauges for version panels and uptime alerts. The active Docker socket watchdog feeds /health and logs state transitions, while trace/log correlation works without an OTLP exporter.
YAML Configuration
ControlDeclarative rules in YAML. Glob patterns for paths, first-match-wins evaluation, and 12 bundled workload presets (drydock, Traefik, Portainer, Watchtower, Homepage, Homarr, Diun, Autoheal, read-only, CIS Docker Benchmark, GitHub Actions self-hosted runner, GitLab Runner) plus the default config.
Tecnativa Compatible
OperationsDrop-in replacement for the current Tecnativa env surface, including section vars, ALLOW_RESTARTS, SOCKET_PATH, and LOG_LEVEL.
Minimal Attack Surface
SecurityWolfi-based image. Cosign-signed with SBOM and build provenance.
Signed Policy Bundles
SecurityTreat the on-disk YAML config as untrusted until a cosign / sigstore bundle confirms it. Supports keyed (PEM ECDSA/RSA/ed25519) and keyless (Fulcio + Rekor) verification. Bundle is checked at startup and on every hot reload — a bad signature rejects the reload and leaves the running policy untouched.
Container Image Trust
SecurityVerify cosign signatures on a container's image before `POST /containers/create` reaches the daemon. Keyed (PEM ECDSA/RSA/ed25519) and keyless (Fulcio issuer + SAN, optional Rekor inclusion) verification, configurable per client profile. `enforce` denies unsigned or wrong-signer images; `warn` logs the failure and forwards the request.
Visibility-Controlled Reads
SecurityLabel selectors hide labeled list, inspect, and selected service/task log reads for non-matching resources, env/mount/network/config/plugin/swarm-sensitive metadata is redacted by default, and raw archive/export reads stay behind explicit opt-in.
Named Client Profiles
ControlRoute callers to named profiles with their own rules and request-body policy by source CIDR, mTLS client certificate selectors including SPKI pins, or unix peer credentials, with a configurable default fallback.
Rate Limits & Concurrency Caps
ControlPer-profile token-bucket rate limiting (`limits.rate`) and in-flight concurrency caps (`limits.concurrency`) return `429 Too Many Requests` with `Retry-After` when exhausted. A system-wide priority fairness gate (`clients.global_concurrency`) prevents low-priority callers from starving high-priority profiles. Anonymous callers bucket under `_anonymous` so they cannot bypass limits by skipping identification.
Per-Profile Rollout Modes
ControlStage policy changes without blocking traffic. Set a profile to `warn` or `audit` to serve requests while logging `decision=would_deny` audit records — then compare blocked vs. would-have-been-blocked in your dashboards before flipping to `enforce`. Pre-auth gates (CIDR allowlist, identity failures) always stay in enforce regardless of profile mode.
Hot-Reload + Admin API
Operationsfsnotify file watch and SIGHUP reload with immutable-field gating — listener, upstream socket, and trust-material fields require a restart. `POST /admin/validate` dry-runs a candidate config without touching the running policy. `GET /admin/policy/version` returns the generation counter, config SHA-256, and verified bundle signer. Optionally binds the admin API to a dedicated listener so admin traffic never traverses the Docker-API filter chain.
Quick Start
Add to your docker-compose.yml and you're done
services:
sockguard:
image: codeswhat/sockguard:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- sockguard-socket:/var/run/sockguard
environment:
- SOCKGUARD_LISTEN_SOCKET=/var/run/sockguard/sockguard.sock
- CONTAINERS=1
- EVENTS=1
your-app:
depends_on:
- sockguard
volumes:
- sockguard-socket:/var/run/sockguard:ro
environment:
- DOCKER_HOST=unix:///var/run/sockguard/sockguard.sock
volumes:
sockguard-socket:Comparison
How we stack up against other Docker socket proxies
| Feature | Tecnativa | LinuxServer | wollomatic | 11notes | CetusGuard | Sockguard |
|---|---|---|---|---|---|---|
| Method + path filtering | Yes | Yes | Yes (regex) | Read-only (fixed) | Yes (regex) | Yes |
| Granular POST ops | No | Partial | Via regex | No (read-only) | Via regex | Yes |
| Request body inspection | No | No | Partial (bind-mount restrictions) | No | No | Yes (container, exec, image, build, volume, network, secret, config, service, swarm, node, plugin) |
| Per-client policies | No | No | IP/hostname + labels | No | No | CIDR + labels + cert selectors incl. SPKI + unix peer |
| Resource owner labels | No | No | No | No | No | Yes (workload + control plane) |
| Remote TCP mTLS (listener) | No | No | No | No (plaintext TCP) | Yes | Yes (TLS 1.3) |
| Remote daemon upstream (TLS) | No | No | No | No | Yes | Roadmap (v1.1) |
| Read-side visibility / redaction | No | No | No | Partial (blocks 7 risky GETs) | No | Yes (visibility + protected JSON redaction) |
| Structured access logs | No | No | Yes (JSON option) | No | No | Yes (request + trace correlation) |
| Dedicated audit log schema | No | No | No | No | No | Yes (JSON schema + reason codes) |
| Prometheus metrics | HAProxy stats | No | No | No | No | Yes (socket-proxy metrics) |
| Active upstream watchdog | No | No | Yes | No | No | Yes (+ /health + metrics) |
| Trace/log correlation | No | No | No | No | No | Yes (W3C traceparent) |
| YAML config | No | No | No | No | No | Yes |
| Rate limits / concurrency caps | No | No | No | No | No | Yes (per-profile token-bucket + global priority gate) |
| Rollout modes (enforce / warn / audit) | No | No | No | No | No | Yes (per-profile shadow + would_deny audit) |
| Signed policy bundles | No | No | No | No | No | Yes (cosign keyed + keyless, Rekor inclusion) |
| Container image trust | No | No | No | No | No | Yes (cosign keyed + keyless, enforce / warn) |
| Hot-reload + admin API | No | No | No | No | No | Yes (fsnotify/SIGHUP, validate endpoint, policy version) |