Sockguard Logo
Open Source · Apache-2.0

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.

GHCRDocker Hub pullsQuay.ioMulti-archContainer size
StarsForksIssuesLicense Apache-2.0Last commit
CIGo Report CardGo Reference

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.

sockguard — zsh
# What version are we running?
$

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

sockguard capabilities18 modules
01

Default-Deny Posture

Security

Everything 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.

02

Request Body Inspection

Security

Container, 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.

03

mTLS for Remote TCP

Security

Non-loopback TCP listeners require mutual TLS 1.3 by default. Plaintext remote TCP is explicit legacy opt-in only.

04

Owner Label Isolation

Control

Stamp 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.

05

Client ACL Primitives

Control

Gate 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.

06

Granular Control

Control

Allow start/stop while blocking create/exec. Per-operation POST controls with glob matching.

07

Structured Access Logging

Operations

JSON 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.

08

Operator Observability

Operations

Opt-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.

09

YAML Configuration

Control

Declarative 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.

10

Tecnativa Compatible

Operations

Drop-in replacement for the current Tecnativa env surface, including section vars, ALLOW_RESTARTS, SOCKET_PATH, and LOG_LEVEL.

11

Minimal Attack Surface

Security

Wolfi-based image. Cosign-signed with SBOM and build provenance.

12

Signed Policy Bundles

Security

Treat 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.

13

Container Image Trust

Security

Verify 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.

14

Visibility-Controlled Reads

Security

Label 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.

15

Named Client Profiles

Control

Route 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.

16

Rate Limits & Concurrency Caps

Control

Per-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.

17

Per-Profile Rollout Modes

Control

Stage 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.

18

Hot-Reload + Admin API

Operations

fsnotify 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

docker-compose.yml
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

FeatureTecnativaLinuxServerwollomatic11notesCetusGuardSockguard
Method + path filteringYesYesYes (regex)Read-only (fixed)Yes (regex)Yes
Granular POST opsNoPartialVia regexNo (read-only)Via regexYes
Request body inspectionNoNoPartial (bind-mount restrictions)NoNoYes (container, exec, image, build, volume, network, secret, config, service, swarm, node, plugin)
Per-client policiesNoNoIP/hostname + labelsNoNoCIDR + labels + cert selectors incl. SPKI + unix peer
Resource owner labelsNoNoNoNoNoYes (workload + control plane)
Remote TCP mTLS (listener)NoNoNoNo (plaintext TCP)YesYes (TLS 1.3)
Remote daemon upstream (TLS)NoNoNoNoYesRoadmap (v1.1)
Read-side visibility / redactionNoNoNoPartial (blocks 7 risky GETs)NoYes (visibility + protected JSON redaction)
Structured access logsNoNoYes (JSON option)NoNoYes (request + trace correlation)
Dedicated audit log schemaNoNoNoNoNoYes (JSON schema + reason codes)
Prometheus metricsHAProxy statsNoNoNoNoYes (socket-proxy metrics)
Active upstream watchdogNoNoYesNoNoYes (+ /health + metrics)
Trace/log correlationNoNoNoNoNoYes (W3C traceparent)
YAML configNoNoNoNoNoYes
Rate limits / concurrency capsNoNoNoNoNoYes (per-profile token-bucket + global priority gate)
Rollout modes (enforce / warn / audit)NoNoNoNoNoYes (per-profile shadow + would_deny audit)
Signed policy bundlesNoNoNoNoNoYes (cosign keyed + keyless, Rekor inclusion)
Container image trustNoNoNoNoNoYes (cosign keyed + keyless, enforce / warn)
Hot-reload + admin APINoNoNoNoNoYes (fsnotify/SIGHUP, validate endpoint, policy version)