Open letsgolesco opened 9 years ago
+1
The simplest workaround which I found is to rely on sequence of starting virtual machines by doker-machine.
VirtualBox has DHCP server which starts assigning IP adresses from 192.168.99.100.
Stop all VMs
docker-machine stop ${docker-machine ls -q}
This step will release all assigned addresses to VirtualBox DHCP
Start VMs in order
docker-machine start vbox1 && docker-machine start vbox2 && docker-machine start vbox3
This steps assign IP like this:
192.168.99.100 : vbox1
192.168.99.101 : vbox2
192.168.99.102 : vbox3
Notice that docker-machine start vbox1 vbox2 vbox3
will not work, but I don't figure out why.
+1
when i run docker-machine.exe start
, it takes more than 15 sec for DHCP waiting for an IP
(if internet is broken, it takes more than 2minutes), i think if can set a static ip, it can boot fast.
This functionality has been added to Minishift spome time ago, but it needs a modification to the ISO to function. On Hyper-V we ran into issues that the boot2docker image does not played nicely... so it only worked on CentOS and Fedora based images. Also, this does not work with the current KVM driver as it relies on DHCP.
This would need a slight redesign...
On Sun, Feb 3, 2019 at 11:08 PM fcying notifications@github.com wrote:
when i run docker-machine.exe start, it takes more than 15 sec for DHCP waiting for an IP(if internet is broken, it takes more than 2minutes), i think if can set a static ip, it can boot fast.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
--
Gerard Braad | http://gbraad.nl [ Doing Open Source Matters ]
The simplest workaround which I found is to rely on sequence of starting virtual machines by doker-machine.
VirtualBox has DHCP server which starts assigning IP adresses from 192.168.99.100.
- Stop all VMs
docker-machine stop ${docker-machine ls -q}
This step will release all assigned addresses to VirtualBox DHCP- Start VMs in order
docker-machine start vbox1 && docker-machine start vbox2 && docker-machine start vbox3
This steps assign IP like this: 192.168.99.100 : vbox1 192.168.99.101 : vbox2 192.168.99.102 : vbox3Notice that
docker-machine start vbox1 vbox2 vbox3
will not work, but I don't figure out why.
Sometimes I had to kill VBoxNetDHCP.exe process on Windows, to make vbox assign IPs starting from 192.168.99.100 Otherwise, vbox would not release IPs used by previous machines (not sure why)
👍
It would really make my life easier.
The simplest workaround which I found is to rely on sequence of starting virtual machines by doker-machine.
VirtualBox has DHCP server which starts assigning IP adresses from 192.168.99.100.
- Stop all VMs
docker-machine stop ${docker-machine ls -q}
This step will release all assigned addresses to VirtualBox DHCP- Start VMs in order
docker-machine start vbox1 && docker-machine start vbox2 && docker-machine start vbox3
This steps assign IP like this: 192.168.99.100 : vbox1 192.168.99.101 : vbox2 192.168.99.102 : vbox3Notice that
docker-machine start vbox1 vbox2 vbox3
will not work, but I don't figure out why.
It's very useful.
In order to assign a static ip address
192.168.99.50 to my docker-machine (default) on VirtualBox, I used:
$ echo -e "kill \`cat /var/run/udhcpc.eth1.pid\`\nifconfig eth1 192.168.99.50 netmask 255.255.255.0 broadcast 192.168.99.255 up" | docker-machine ssh default sudo tee /var/lib/boot2docker/bootsync.sh > /dev/null
$ docker-machine restart default
Restarting "default"...
(default) Check network to re-create if needed...
(default) Waiting for an IP...
Waiting for SSH to be available...
Detecting the provisioner...
Restarted machines may have new IP addresses. You may need to re-run the `docker-machine env` command.
$ docker-machine env
Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.50:2376": x509: certificate is valid for 192.168.99.103, not 192.168.99.50
You can attempt to regenerate them using 'docker-machine regenerate-certs [name]'.
Be advised that this will trigger a Docker daemon restart which might stop running containers.
$ docker-machine regenerate-certs default
Regenerate TLS machine certs? Warning: this is irreversible. (y/n): y
Regenerating TLS certificates
Waiting for SSH to be available...
Detecting the provisioner...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
$ docker-machine env
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.50:2376"
export DOCKER_CERT_PATH="/Users/mandrake/.docker/machine/machines/default"
export DOCKER_MACHINE_NAME="default"
# Run this command to configure your shell:
# eval $(docker-machine env)
My environment is OSX, VirtualBox (boot2docker.iso)
Hoping this can be useful 🙂 BTW: +1 for the new feature request 😉 Cheers.
Yes, there is an option to create with specific ip. All you need to do is specify ip/ip-range with
--virtualbox-hostonly-cidr
option.
For example:
when you want to assign specific ip, let say you want to assign 10.15.1.24, then appropriate config will be (the most important thing is the mask that we are using here. For specific ip you need to set subnet mask to 32) :
docker-machine create --driver virtualbox --virtualbox-hostonly-cidr "10.15.1.24/32" dev
if you want to pick an ip from specific ip range, then you need to use appropriate subnet mask.
If you issue is that you have to keep updating your host file you can just install Avahi on your container and use mDSN.
It will be very useful to activate this feature to able to assign static ip address while creating vm using docker-machine
Hi, I've been searching through the docs and issues to figure this out but can't find an answer.
Basically, I want to be able to specify the IP address of a VM (i.e. the value that's listed under "URL" in
docker-machine ls
) when I create it withdocker-machine create
.I want this because I've been relying on boot2docker's default address of 192.168.59.103, but now it varies from machine to machine.
Thanks!