Connecting to a Remote Docker Daemon Connecting to a Remote Docker Daemon docker docker

Connecting to a Remote Docker Daemon


You need to configure the Docker daemon in your ubuntu server in order for it to accept tcp connection.By default Docker listen on the unix socket /var/run/docker.sock.To configure your daemon, you can have a look at the documentation here

Step-by-step configuration (in this example, everything is done on the Ubuntu VM) :

Configure the daemon
On Ubuntu, by default you are using systemd. You need to edit the configuration file (usually located in /lib/systemd/system/docker.service) :

[Service]ExecStart=/usr/bin/dockerd --containerd=/run/containerd/containerd.sock -H tcp://0.0.0.0:2375

With this example, the Docker daemon no longer listen on the unix socket. It only listen on tcp call from localhost.
Restart the daemon :

$> sudo systemctl daemon-reload$> sudo systemctl restart docker.service

Configure the client (still on the VM)
After restarting the daemon, your docker client does not work anymore (as you've just told the client to only listen to tcp connection). Thus, if you do docker image ls it should not respond. In order for your client to work, you need to tell it which server to connect to :

$> export DOCKER_HOST="tcp://0.0.0.0:2375"

Now, your client should be able to connect to the daemon (i.e : docker image ls should print all the images)

This should work fine on your Ubuntu server. You just need to apply the same client configuration on Windows. If it does not work on Windows, then it means something else is blocking the trafic (probably a firewall).

Hope this helps.


Resolved it by the this link.

The port needs to be changed to 2376 though.