A simple docker-machine replacement that take advantage of SSH socket forwarding.
- Deploy this on remote machine
docker run -d --restart=always -p 2377:22 \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v ~/.ssh/authorized_keys:/root/.ssh/authorized_keys:ro \
--name docker-socket-tunnel teambun/docker-socket-tunnel
- Forward Docker socket
ssh -NTL /tmp/docker.sock:/var/run/docker.sock -p 2377 remote
- Connect to remote docker
unset DOCKER_TLS_VERIFY
export DOCKER_HOST=unix:///tmp/docker.sock
docker ps
- Get scripts
- Deploy this to remote machine:
dockertunnel-init user@remote
- Run docker client:
dockertunnel user@remote docker ps