Search code examples
dockerboot2dockerdocker-machine

How stable/reliable are the boot2docker and docker-machine IP addresses?


I know that I can use boot2docker ip or docker-machine ip to get the assigned IP address of the boot2docker/docker-machine VM.

From what I understand the default IP addresses are:

  • boot2docker: 192.168.59.103
  • docker-machine: 192.168.99.100

Here are my questions related to this:

  • Can I assume that these addresses will generally be used, unless there's a conflict with another device/VM on the same network/host?
  • When stopping/starting boot2docker or docker-machine on the same machine, can I rely on the VM always using the same IP address?

I'm asking since I would like to store the environment variables created by boot2docker shellinit or docker-machine env dev in my user's profile, so I don't have to run these commands every time I start/stop the VM.


Solution

  • You definitely can not rely. I've been playing around a lot with docker-machine on local with virtualbox driver, and what I noticed is that the ip addresses assigned by docker-machine depend on the order of machine start. The first started machine gets .100 (even if before it was 119).