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 the machine itself and I find no instructions on how to do this. I can connect to the ssh port:
ssh $(docker-machine ip dev)
But I've no idea what username / password / identity file to use.
If for some reason you'd rather use the
ssh
command rather thandocker-machine ssh
, you can doFor 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.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.
You can log into docker-machine hosts by just running
(Using the "default" host here)
The identity files should be stored under
~/.docker/machine/machines
. If you want to log into a container (as opposed to the host), usedocker exec
as suggested by user2915097.if you really need to do it via
ssh
, this is working with docker 1.8.2init docker:
get the IP from your default docker machine:
this prints something like this out:
192.168.99.100
password is
tcuser
but you can also use the identity file, see other answerFor mac OX,the machine and its keys are located here (make sure you have the keys in there, something like the below:
1) list available vms.
In my case, the name of the machine is default. So, just
As you can see, I am able to ssh into docker-machine/instance.
You can also follow this > howto - docker
Finally, I found an answer :
I'm on Windows with Docker Toolbox (Docker Machine).
If I
docker-machine -D ssh default
, I find that the SSH parameters should be :Host : localhost
Port : 51701
User : docker
Key : .docker\machine\machines\default\id_rsa
When I change my Putty/MobaXterm settings to match, voila, I can SSH into the container.