Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ssh into docker-machine VirtualBox instance?

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.

like image 611
Roy Truelove Avatar asked May 19 '15 15:05

Roy Truelove


People also ask

Can I use docker in VirtualBox?

Docker machines runs as a VirtualBox virtual machine as you're using the VirtualBox Docker Machine driver. So, it uses up your system memory (RAM). You may not want to run all the Docker machines at the same time. Instead, run only the machines you need.


2 Answers

You can log into docker-machine hosts by just running

docker-machine ssh default 

(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), use docker exec as suggested by user2915097.

like image 103
Adrian Mouat Avatar answered Nov 13 '22 01:11

Adrian Mouat


if you really need to do it via ssh, this is working with docker 1.8.2

init docker:

eval "$(docker-machine env default)" 

get the IP from your default docker machine:

docker-machine ip default 

this prints something like this out: 192.168.99.100

ssh [email protected] 

password is tcuser but you can also use the identity file, see other answer

like image 37
timaschew Avatar answered Nov 13 '22 01:11

timaschew