The Docker API listens on TCP
- Check
net.docker_api_tcp- Severity
- critical
- Runs
- on the server, in the daily run of the agent
- Looks at
- TCP sockets of dockerd, -H tcp:// in the service files, tcp:// in the hosts of daemon.json
What the check looks at
The TCP sockets of dockerd, the hosts entry of /etc/docker/daemon.json, and -H tcp:// or
--host tcp:// options in /etc/default/docker, /etc/sysconfig/docker and the docker.service unit with
its drop-ins. The check fails for a TCP address on the network and warns for one on loopback. The evidence names
the kind of address (0.0.0.0, ipv4-public) and the port.
Risk
The Docker API can start a container with the root directory of the host mounted. Over TCP without TLS client certificates (port 2375 by convention, 2376 with TLS), any client that reaches the port can do that with one HTTP request. Docker deprecated TCP without TLS in Engine 26.0, but Docker Engine 29.9.2 still starts with such a listener. In a test it logged a deprecation notice, delayed its start by 16 seconds and then answered API requests without authentication. With TLS, every holder of a client certificate is still root on the host.
How to fix it
-
Find where the TCP address comes from:
ps -o args= -C dockerd systemctl cat docker.service # systemd: look at ExecStart and the drop-ins grep -s hosts /etc/docker/daemon.jsonOn Alpine, also look at
DOCKER_OPTSin/etc/conf.d/docker. -
Remove the
-H tcp://...option or thetcp://entry inhosts. Keep-H fd://(the systemd units of the Docker packages) or the Unix socket. -
Restart Docker. This stops the running containers unless
live-restoreis on indaemon.json:sudo systemctl daemon-reload && sudo systemctl restart docker # systemd sudo rc-service docker restart # Alpine (OpenRC) -
For remote administration, use SSH:
docker context create prod --docker host=ssh://deploy@203.0.113.10 docker --context prod ps
If you need TCP, use TLS with client certificates on port 2376 (--tlsverify, --tlscacert, --tlscert,
--tlskey), and in the firewall allow the port only from known addresses.
How to check the fix
sudo ss -tlnp | grep dockerd
The output must be empty. From another machine, nc -zv -w 3 <server> 2375 must fail.
When a warning is fine
A TLS listener with client certificates, behind a firewall that allows only a management host, can be a
deliberate setup; guard the certificates like root SSH keys. A plain listener on 127.0.0.1 cannot be reached
from the network, but every local user and process can use it, also those outside the docker group. A plain
listener on a public or private network address is never fine.
Sources
- Docker docs: Protect the Docker daemon socket (SSH contexts, TLS on port 2376)
- Docker docs: Deprecated features, Unauthenticated TCP connections (deprecated in 26.0, target for removal 28.0)
- Docker Engine 26.0 release notes (deprecation notice for remote TCP connections without TLS, moby#47556)
- Test run on 2026-11-26:
dockerd29.9.2 with-H tcp://0.0.0.0:2375in a container without network access answeredGET /_pingover plain TCP after 16 seconds - Docker docs: Docker security, Docker daemon attack surface