Forward a Unix socket over SSH
In all examples, <host> represents a remote host.
sudo forward_socket \
--local_user $(id -un) \
"ssh -i $HOME/.ssh/id_rsa $(id -un)@<host>" \
/var/run/docker.sock- Sudo so that you can create the local
/var/run/docker.sock - SSH into your host, with your current user's username, and your
id_rsa(can't just use , because the sudo will ssh asroot@<host>and use root's keys) - Listen at
/var/run/docker.sock(the same as the remote) - Set the listen socket's owner to your current user
sudo forward_socket
--local_user $(id -un) \
"ssh -i $HOME/.ssh/id_rsa -o ControlMaster auto -o ControlPersist 600 -o ControlPath docker_ssh.sock $(id -un)@<host>" \
/var/run/docker.sockMostly the same as the forwarding above, except:
ControlMaster autoadds connection poolingControlPersist 600sets the connection pool timeout to 600ControlPath docker_ssh.sockcreates the shared SSH socketdocker_ssh.sock