Checks / Network

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
dockerd started with -H tcp:// or a daemon.json hosts entry with tcp
Updated 26 Nov 2026

What the check looks at

The agent reads the command line of dockerd and the hosts entry of /etc/docker/daemon.json. It reports a failure when either names a tcp:// address. The evidence line shows the address, for example -H tcp://0.0.0.0:2375.

Why it matters

The Docker API can start containers with the root directory of the host mounted. Over TCP without TLS client certificates, any client that reaches the port can do that with one HTTP request, without a password. Port 2375 is the usual plain port and 2376 the TLS port.

Since Docker Engine 27.0, the daemon requires TLS verification for every TCP address except tcp://localhost, according to the deprecation notes of Docker. Older versions accept plain TCP. A TLS listener protects the connection, but every holder of a client certificate is still root on the host.

How to fix it

The steps are the same on Debian, Ubuntu, RHEL, Rocky, Alma and Alpine with OpenRC, except for the service commands.

  1. 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.json
    

    On Alpine, also look at DOCKER_OPTS in /etc/conf.d/docker.

  2. Remove the -H tcp://... option or the tcp:// entry in hosts. Keep -H fd:// (systemd units of the Docker packages) or the Unix socket.

  3. Restart Docker. This stops running containers unless live-restore is on in daemon.json:

    sudo systemctl daemon-reload && sudo systemctl restart docker   # systemd
    sudo rc-service docker restart                                  # Alpine (OpenRC)
    
  4. For remote administration, use SSH instead:

    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 allow the port in the firewall only from known addresses.

How to check the fix

sudo ss -tlnp | grep dockerd

No output means dockerd does not listen on TCP. From another machine, nc -zv -w 3 <server> 2375 should fail.

When a warning is fine

A TLS listener with client certificates behind a firewall that allows only a management host is a deliberate setup; keep 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 TCP listener on a public or private network address is never fine.

Sources