I can create a Docker instance with the VirtualBox driver, but I cannot figure out how to specify the URL.
Create Command:
docker-machine create --driver virtualbox myBox
docker-machine ls:
NAME ACTIVE DRIVER STATE URL SWARM
myBox * virtualbox Running tcp://192.168.99.100:2376
I want the URL to be a specific URL. How can I force the Docker instance to use a specific URL (ex: 192.168.99.113)?
Details: Mac 10.10.5 using Docker Toolbox
I tried using the --virtualbox-hostonly-cidr
command to set the IP range for the docker machine; I specified a range of one IP address ("192.168.99.113/32"), but the machine created had an IP of 192.168.99.100, which is outside of the range I provided.
Is it even possible to set a docker machine with specific IP address?
We had the same problem some time ago, trying to change default docker IP in docker machine and we found only 2 ways, how to do it.
You can call a create command of docker machine to create your Docker instance with flag
--virtualbox-hostonly-cidr "192.168.99.1/24"
This flag set a range of addresses, which could be set for a Docker instance. No guarantee, you get the address you want
You can change network settings of virtual machine, leaving NAT and port forwarding for it, making your Docker instance running like it was installed on Host OS.
Of course, the first one is standard approach and seems to be preferable. But in some cases, the second could be usefull too.
Update:
There is an open feature request for specifying a static IP for docker machine. So, unfortunately it's not possible to do it right now. Only --virtualbox-hostonly-cidr
property, but you have to provide a CIDR Prefix below 29 to make it works (tested for Win version). Or take a look at this comment, where is shown, how you can do it for OS X by configuring Virtual Box, like:
$ VBoxManage dhcpserver modify --ifname vboxnet0 --disable
$ VBoxManage dhcpserver modify --ifname vboxnet0 --ip 192.168.59.3 --netmask 255.255.255.0 --lowerip 192.168.59.103 --upperip 192.168.59.203
$ VBoxManage dhcpserver modify --ifname vboxnet0 --enable
$ docker-machine create --driver "virtualbox" --virtualbox-cpu-count "-1" --virtualbox-disk-size "30000" --virtualbox-memory "2560" --virtualbox-hostonly-cidr "192.168.59.3/24" dev