Skip to content

Instantly share code, notes, and snippets.

@walm
Created June 25, 2014 13:01
Show Gist options
  • Save walm/40a2f1021ecef6ffeafc to your computer and use it in GitHub Desktop.
Save walm/40a2f1021ecef6ffeafc to your computer and use it in GitHub Desktop.
Dynamic SSH host config for docker containers
# usage: ssh <container-name>.doc
Host *.doc
ProxyCommand netcat $(docker inspect --format '{{ .NetworkSettings.IPAddress }}' `echo %h | sed -e 's/.doc//'`) 22
StrictHostKeyChecking no
User root
IdentityFile /etc/ssh/keys/docker.key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment