4
votes

I want to use docker machine with a remote server docker daemon through ssh so no need to open 2376 port in the remote server.

Local Host:

$ docker-machine create --driver generic --generic-ip-address [IP_Address] --generic-engine-port 2376 --generic-ssh-key ~/.ssh/id_rsa --generic-ssh-user root [Host]

Remote host:

$ docker daemon -H tcp://127.0.0.1:2376

Result of executing the Local Host command:

$ docker-machine create --driver generic --generic-ip-address [IP_Address] --generic-engine-port 2376 --generic-ssh-key ~/.ssh/id_rsa --generic-ssh-user root [Host]

...

Cannot connect to the Docker daemon. Is the docker daemon running on this host?

As per nmap remote port 2376 is closed, so the error makes sense.

I have tried tunneling through ssh by executing the following in my local host:

$ ssh -L 2376:127.0.0.1:2376 [Remote_Host]

** Note docker machine is trying to reach docker daemon in the remote host, so the tunnel is useful **

I thought maybe using ssh -R or a combination of both would work but I have not been able to make it work yet, do you have any idea or workaround to make this work?

Do not hesitate to bring me to a completely different approach to solve this.

Thanks in advance.

1
Is SSH service running on the remote machine that you are trying to connect to?ishmaelMakitla
yes, is it runningoscar gomez

1 Answers

1
votes

Have you tried rdocker? It seems to do exactly what you are looking for. Cheers