Make a Docker environment accessible over TCP. Always be aware about security threats and how to protect the docker socket.

We need to generate certificates for the server and the client, then alter the Docker /etc/docker/daemon.json configuration:

{
    "tlsverify": true,
    "tlscacert": "/etc/docker/certs/ca-cert.pem",
    "tlscert": "/etc/docker/certs/server-cert.pem",
    "tlskey": "/etc/docker/certs/server-key.pem",
    "host": "tcp://X.X.X.X:PORT"
}

However this is not sufficient: adjusting the systemd unit is needed, by patching the corresponding line :

 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H tcp://X.X.X.X:PORT