Conflicting IPs with docker machine

If you are using multiple machines with docker-machine they will get an automatic IP starting from , then and so on. The problem comes when you restart your system and start the machines in different order. Virtualbox will assign different IPs this time around, this makes the certificates invalid and you need to regenerate them. No problem there, but if you have mapped an IP to a domain in your hosts file, then trouble begins.

You can’t really control which IP virtualbox will assign to the machine; see . So you can not assign a specific IP to a docker-machine virtualbox vm.

But you can give it a range and assume it will fall in the 192.168.x.100 pattern. Use the following command when creating.

docker-machine create -d virtualbox --virtualbox-hostonly-cidr "" victor

So when you restart your computer, they will respect the range and usually will fall in the .100 IP

Also consider other workarounds presented in that thread, like this script:

Published :

Last modified :


comments powered by Disqus