Last Updated: August 12, 2019
·
2.208K
· MidnightLightning

Vagrant SSH into Docker controller

Vagrant added the ability to use Docker as a provider with its 1.6 release, and if you use that option on an OSX or Windows host machine, it will automatically grab the boot2docker VM to serve as host for your Docker containers.

However, then vagrant ssh will try and SSH into the container not the Docker host VM. So, how do you get into that machine if you want to?

Create a Vagrant Docker deployment and run

vagrant up --provider=docker

from within that project folder. That will download and start up the boot2docker VM if it wasn't already.

From the boot2docker readme, the credentials to SSH into the machine are:

user: docker
pass: tcuser

And since the default vagrant up setup creates an SSH tunnel from the host machine to localhost on port 2222, we can then SSH into the Docker host with:

ssh -p 2222 docker@localhost

and entering tcuser as the password when prompted.