Skip to content

Instantly share code, notes, and snippets.

@Roadmaster
Created October 5, 2018 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Roadmaster/08c44bf715feb80017720317bbdfd42f to your computer and use it in GitHub Desktop.
Save Roadmaster/08c44bf715feb80017720317bbdfd42f to your computer and use it in GitHub Desktop.
how to ssh into local lxd containers
# snippet for .ssh/config
Host *.lxd
#User ubuntu
#StrictHostKeyChecking no
#UserKnownHostsFile /dev/null
ProxyCommand nc $(lxc list --format csv -c s4 $(echo %h | sed "s/\.lxd//g") %h | python3 -c "import csv,sys; print([ip for ip in [e.split('\n') for s,e in list(csv.reader(sys.stdin)) if s == 'RUNNING'][0] if
'eth' in ip][0].split(' ')[0])") %p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment