docker-machine version 0.2.0 docker version 1.6.2
I\'m using docker-machine to create a machine using VirtualBox. Everything works fine but I\'d like to ssh into th
For the hackers out there, here is a script that will ssh into the 'active' docker-machine. This also gives you the values for the ssh_key, ssh_port, and the ssh_user, making it possible to do things like rsync
between the localhost and the VM.
#!/bin/bash
docker_machine_name=$(docker-machine active)
docker_ssh_user=$(docker-machine inspect $docker_machine_name --format={{.Driver.SSHUser}})
docker_ssh_key=$(docker-machine inspect $docker_machine_name --format={{.Driver.SSHKeyPath}})
docker_ssh_port=$(docker-machine inspect $docker_machine_name --format={{.Driver.SSHPort}})
ssh -i $docker_ssh_key -p $docker_ssh_port $docker_ssh_user@localhost
You can copy and paste that into your terminal, line for line, and it will work. Or, make the script into a function, and feed it the name as an argument.