Skip to content

Instantly share code, notes, and snippets.

@cedricvidal
Last active August 31, 2015 09:20
Show Gist options
  • Save cedricvidal/a7365160a9efb8ba066e to your computer and use it in GitHub Desktop.
Save cedricvidal/a7365160a9efb8ba066e to your computer and use it in GitHub Desktop.
Configure remote docker over SSH
HOST=user@host
# Make sure socat is installed on remote before starting tunnel
ssh $HOST socat -V | grep "socat version" | cat 1>&2
# Start tunnel
echo "starting tunnel" 1>&2
(socat "UNIX-LISTEN:/tmp/$HOST-docker.sock,reuseaddr,fork" "EXEC:'ssh -kTax $HOST socat STDIO UNIX-CONNECT\:/var/run/docker.sock'" 2>&1 | >&2 xargs echo) &
# Tell docker
echo export DOCKER_HOST=unix:///tmp/$HOST-docker.sock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment