Search code examples
dockervirtual-machinevirtualboxboot2dockerdocker-machine

How Can I Change the VirtualBox VM that Docker is Connected To?


When I start up the Docker Quickstart Terminal, it automatically stands up a virtual machine in VirtualBox called "default", and connects to it. I have a second VM running boot2docker, however, that I would like to use instead of the "default" one (let's call it "myVM").

I would like to change the Docker Terminal's connection over to myVM, so that I can issue commands like "docker images" or "docker ps" without having to specify the IP address, port etc. (so I don't have to do something like "docker -H 192.168.99.105:2376 blah"). How can I go about accomplishing this?


Solution

  • To connect your shell to the new myVM machine.

    eval $(docker-machine env myVM) 
    

    This sets environment variables for the current shell that the Docker client will read which specify the TLS settings. You need to do this each time you open a new shell or restart your machine.