Open Gibby opened 3 years ago
The underlying library used for the Docker API doesn't support the "ssh://" option, sorry. You need to use tcp with certificates for security.
I was able to work around this limitation using socat over SSH.
Instructions here: https://serverfault.com/a/362833
Just incase anyone else is in a similar situation
For a bit more convenience, I created a systemd daemon
Do everything as root. location: /etc/systemd/system/docker-remote-sock@.service
Description=Setup a secure tunnel for docker.sock to %i
After=network.target
[Service]
Group=docker
ExecStart=ssh -o StreamLocalBindUnlink=yes -o StreamLocalBindMask=0117 -nNT -L /var/run/docker.%i.sock:/var/run/docker.sock %i
RestartSec=30
Restart=always
[Install]
WantedBy=multi-user.target
Enable it on boot with systemctl enable docker-remote-sock@server
Be sure you have placed the id_rsa.pub into the authorized_keys file for the root of the other server, so no login is needed.
Per https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-socket-option starting in Docker version 18.09 the following can be used to connect to a remote docker host:
When I tried to specify
ssh://me@example.com
in the URL, I get the following error: