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.sock
Mostly the same as the forwarding above, except:
ControlMaster auto
adds connection poolingControlPersist 600
sets the connection pool timeout to 600ControlPath docker_ssh.sock
creates the shared SSH socketdocker_ssh.sock