New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Specify a static IP for VirtualBox VMs #1709

Open
letsgolesco opened this Issue Aug 15, 2015 · 203 comments

Comments

Projects
None yet
@letsgolesco

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 with docker-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!

@hanks

This comment has been minimized.

Show comment
Hide comment
@hanks

hanks Aug 18, 2015

+1, need this feature

hanks commented Aug 18, 2015

+1, need this feature

@krancour

This comment has been minimized.

Show comment
Hide comment

+1

@jsuksl

This comment has been minimized.

Show comment
Hide comment

jsuksl commented Aug 19, 2015

+1

@nathanleclaire nathanleclaire changed the title from Specify IP address of new VM? to [Feature Request] Specify a static IP for VirtualBox VMs Aug 19, 2015

@FlorianLoch

This comment has been minimized.

Show comment
Hide comment

+1

@krancour

This comment has been minimized.

Show comment
Hide comment
@krancour

krancour Aug 25, 2015

Here's a good workaround. Add the following to your ~/.bash_profile:

eval `docker-machine env <docker-machine name>`
export <some variable>=$(docker-machine ip <docker-machine name>)

Here's a good workaround. Add the following to your ~/.bash_profile:

eval `docker-machine env <docker-machine name>`
export <some variable>=$(docker-machine ip <docker-machine name>)
@luislavena

This comment has been minimized.

Show comment
Hide comment
@luislavena

luislavena Aug 26, 2015

@letsgolesco you can use --virtualbox-hostonly-cidr option for that, which will select the proper vboxnetX host-only adapter.

By default, seems docker-machine picks one randomly, so forced to use the one for vboxnet0 (192.168.59.3/24, the one used by boot2docker) seems to solve the issue:

$ docker-machine create --driver virtualbox --virtualbox-hostonly-cidr "192.168.59.3/24" dev
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env dev

$ docker-machine ip dev
192.168.59.103

Cheers.

@letsgolesco you can use --virtualbox-hostonly-cidr option for that, which will select the proper vboxnetX host-only adapter.

By default, seems docker-machine picks one randomly, so forced to use the one for vboxnet0 (192.168.59.3/24, the one used by boot2docker) seems to solve the issue:

$ docker-machine create --driver virtualbox --virtualbox-hostonly-cidr "192.168.59.3/24" dev
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env dev

$ docker-machine ip dev
192.168.59.103

Cheers.

@krinkere

This comment has been minimized.

Show comment
Hide comment
@krinkere

krinkere Sep 11, 2015

@luislavena - Unfortunately that did not work.

@luislavena - Unfortunately that did not work.

@krinkere

This comment has been minimized.

Show comment
Hide comment
@krinkere

krinkere Sep 11, 2015

+1

Def need this feature though!

+1

Def need this feature though!

@luislavena

This comment has been minimized.

Show comment
Hide comment
@luislavena

luislavena Sep 11, 2015

@krinkere not sure your env, but this worked for my OSX installation by doing that, but failed when using machine on Linux, which required tweaks to dhcpserver configuration of vboxnet0:

$ 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

This is, as you can see, a huge hack 😸, but works for now 😄

@krinkere not sure your env, but this worked for my OSX installation by doing that, but failed when using machine on Linux, which required tweaks to dhcpserver configuration of vboxnet0:

$ 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

This is, as you can see, a huge hack 😸, but works for now 😄

@joaquinrulin

This comment has been minimized.

Show comment
Hide comment
@joaquinrulin

joaquinrulin Sep 13, 2015

Would love to see this feature!!

Would love to see this feature!!

@krinkere

This comment has been minimized.

Show comment
Hide comment
@krinkere

krinkere Sep 14, 2015

@luislavena - Thanks for your response

Here is what I get on my Mac.

$ docker-machine create --driver virtualbox --virtualbox-hostonly-cidr "192.168.99.3/24" dev
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env dev

$ docker-machine ip dev
192.168.99.100

While I do have ip in the right subnet, it is not the IP that I would want to use... Def would love to see this feature

@luislavena - Thanks for your response

Here is what I get on my Mac.

$ docker-machine create --driver virtualbox --virtualbox-hostonly-cidr "192.168.99.3/24" dev
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env dev

$ docker-machine ip dev
192.168.99.100

While I do have ip in the right subnet, it is not the IP that I would want to use... Def would love to see this feature

@kleww

This comment has been minimized.

Show comment
Hide comment
@kleww

kleww Sep 16, 2015

+1 usefull feature

kleww commented Sep 16, 2015

+1 usefull feature

@jwebb-va

This comment has been minimized.

Show comment
Hide comment
@jwebb-va

jwebb-va Sep 21, 2015

+1 This feature would really help us out!

We use docker-machine to run a local Elasticsearch cluster and we have /etc/hosts entry for 192.168.59.103 which maps to elastic-local.mycompany.com. Since we have moved over to docker-machine from boot2docker, we have had to continuously manually update this hosts file entry to whatever is the new IP assigned to our docker VM. We could write some automation which would update this hosts file entry for us but it would be much simpler if docker-machine just let us use a configurable IP address for new machines.

+1 This feature would really help us out!

We use docker-machine to run a local Elasticsearch cluster and we have /etc/hosts entry for 192.168.59.103 which maps to elastic-local.mycompany.com. Since we have moved over to docker-machine from boot2docker, we have had to continuously manually update this hosts file entry to whatever is the new IP assigned to our docker VM. We could write some automation which would update this hosts file entry for us but it would be much simpler if docker-machine just let us use a configurable IP address for new machines.

@regisxu

This comment has been minimized.

Show comment
Hide comment

regisxu commented Sep 25, 2015

+1

@wateryoma

This comment has been minimized.

Show comment
Hide comment

+1

@florrain

This comment has been minimized.

Show comment
Hide comment

+1

@fjallot

This comment has been minimized.

Show comment
Hide comment

fjallot commented Sep 29, 2015

+1

@davideuler

This comment has been minimized.

Show comment
Hide comment

+1

@alekzvik

This comment has been minimized.

Show comment
Hide comment

alekzvik commented Oct 1, 2015

+1

@Kroisse

This comment has been minimized.

Show comment
Hide comment

Kroisse commented Oct 2, 2015

+1

@ardydedase

This comment has been minimized.

Show comment
Hide comment

+1

@oprearocks

This comment has been minimized.

Show comment
Hide comment

+1

@ianlintner-wf

This comment has been minimized.

Show comment
Hide comment

+1

@simeonpashley

This comment has been minimized.

Show comment
Hide comment

+1 (y)

@MRylander

This comment has been minimized.

Show comment
Hide comment

+1

@nh

This comment has been minimized.

Show comment
Hide comment

nh commented Oct 13, 2015

+1

@gvisniuc

This comment has been minimized.

Show comment
Hide comment

+1

@ianlintner-wf

This comment has been minimized.

Show comment
Hide comment
@ianlintner-wf

ianlintner-wf Oct 16, 2015

Temporarily I am using some bash scripts to update the hosts files but is kludgy since you have to update /etc/hosts via sudo'd script but since you can get ip from docker-machine it works. I may share a gist.

Temporarily I am using some bash scripts to update the hosts files but is kludgy since you have to update /etc/hosts via sudo'd script but since you can get ip from docker-machine it works. I may share a gist.

@devopsguru

This comment has been minimized.

Show comment
Hide comment
@devopsguru

devopsguru Oct 16, 2015

ianlintner-wf, do share the script please. I'm about to write one exactly like that myself, but if I can not reinvent the wheel that'd be great.. yeah..

ianlintner-wf, do share the script please. I'm about to write one exactly like that myself, but if I can not reinvent the wheel that'd be great.. yeah..

@ianlintner-wf

This comment has been minimized.

Show comment
Hide comment
@ianlintner-wf

ianlintner-wf Oct 16, 2015

Here is the primary script I am using. I cleaned it up a little, but it lacks more formal default params and other stuff.

https://gist.github.com/ianlintner-wf/a2b917158aaf100d9fb3

Here is the primary script I am using. I cleaned it up a little, but it lacks more formal default params and other stuff.

https://gist.github.com/ianlintner-wf/a2b917158aaf100d9fb3

@cookandy

This comment has been minimized.

Show comment
Hide comment
@cookandy

cookandy Oct 20, 2015

+1 please!

+1 please!

@cookandy

This comment has been minimized.

Show comment
Hide comment
@cookandy

cookandy Oct 21, 2015

thanks for the script @ianlintner-wf. I have written one that dynamically adds the host/ip of any running docker machines. Have tested on OS X El Capitan.

https://gist.github.com/cookandy/f14fadd31721dc6e136e

thanks for the script @ianlintner-wf. I have written one that dynamically adds the host/ip of any running docker machines. Have tested on OS X El Capitan.

https://gist.github.com/cookandy/f14fadd31721dc6e136e

@xwang-gobalto

This comment has been minimized.

Show comment
Hide comment
@xwang-gobalto

xwang-gobalto Oct 22, 2015

The IP increment is cached by VirtualBox DHCP server. Stop and restart VirtualBox will reset the IP increment.

The IP increment is cached by VirtualBox DHCP server. Stop and restart VirtualBox will reset the IP increment.

@jcpst

This comment has been minimized.

Show comment
Hide comment
@jcpst

jcpst Oct 23, 2015

+1, our OSX devs are still using boot2docker because our env relies on static /etc/hosts entries. (btw thanks for the script @ianlintner-wf )

jcpst commented Oct 23, 2015

+1, our OSX devs are still using boot2docker because our env relies on static /etc/hosts entries. (btw thanks for the script @ianlintner-wf )

@brandonsimpson

This comment has been minimized.

Show comment
Hide comment
@webfella

This comment has been minimized.

Show comment
Hide comment

webfella commented Nov 2, 2015

+1

@nicbarker

This comment has been minimized.

Show comment
Hide comment

+1

@dikarel

This comment has been minimized.

Show comment
Hide comment
@dikarel

dikarel Sep 23, 2016

+1

Arbitrarily-changing VM IPs and TLS certs that suddenly become invalid upon reboot has caused lots of gotcha moments and wasted man-hours

dikarel commented Sep 23, 2016

+1

Arbitrarily-changing VM IPs and TLS certs that suddenly become invalid upon reboot has caused lots of gotcha moments and wasted man-hours

@unixunion

This comment has been minimized.

Show comment
Hide comment
@unixunion

unixunion Sep 23, 2016

Is this even prioritised? A whole 13 months this case has been open. +10000

Is this even prioritised? A whole 13 months this case has been open. +10000

@kgx

This comment has been minimized.

Show comment
Hide comment
@kgx

kgx Sep 23, 2016

My guess is that there is a philosophical disagreement between some people on the docker machine team and the rest of the world on this issue. Using DHCP and having a non deterministic IP is pretty much worthless for all of my uses cases.

I have been using this workaround for the last year. It is adapted from some of the one-liner workarounds described above.

SSH onto the docker machine
docker-machine ssh default

Add/edit the boot2docker startup script
sudo vi /var/lib/boot2docker/bootsync.sh

#!/bin/sh
/etc/init.d/services/dhcp stop
ifconfig eth1 192.168.99.50 netmask 255.255.255.0 broadcast 192.168.99.255 up

sudo chmod 755 /var/lib/boot2docker/bootsync.sh
exit

Restart machine and regenerate certs
docker-machine restart default
docker-machine regenerate-certs default

kgx commented Sep 23, 2016

My guess is that there is a philosophical disagreement between some people on the docker machine team and the rest of the world on this issue. Using DHCP and having a non deterministic IP is pretty much worthless for all of my uses cases.

I have been using this workaround for the last year. It is adapted from some of the one-liner workarounds described above.

SSH onto the docker machine
docker-machine ssh default

Add/edit the boot2docker startup script
sudo vi /var/lib/boot2docker/bootsync.sh

#!/bin/sh
/etc/init.d/services/dhcp stop
ifconfig eth1 192.168.99.50 netmask 255.255.255.0 broadcast 192.168.99.255 up

sudo chmod 755 /var/lib/boot2docker/bootsync.sh
exit

Restart machine and regenerate certs
docker-machine restart default
docker-machine regenerate-certs default

@sebferry

This comment has been minimized.

Show comment
Hide comment

sebferry commented Oct 6, 2016

+1

@Smoker21

This comment has been minimized.

Show comment
Hide comment

Smoker21 commented Oct 7, 2016

+1

@davidaparicio

This comment has been minimized.

Show comment
Hide comment
@davidaparicio

davidaparicio Oct 12, 2016

+1 (for docker-machine and jimmidyson/minishift)

+1 (for docker-machine and jimmidyson/minishift)

@tonivdv tonivdv referenced this issue in adlogix/docker-machine-nfs Oct 16, 2016

Closed

Virtualbox host only /24 #62

@mandeepmehra

This comment has been minimized.

Show comment
Hide comment

+1

@michaelalhilly

This comment has been minimized.

Show comment
Hide comment
@michaelalhilly

michaelalhilly Oct 28, 2016

@eytanhanig Unfortunately your method did not work for me. I'm on OS X 10.11.6. The machines get the desired IPs but there is an error connecting to them. Docker suggests regenerating keys, but that did not fix the issue.

@eytanhanig Unfortunately your method did not work for me. I'm on OS X 10.11.6. The machines get the desired IPs but there is an error connecting to them. Docker suggests regenerating keys, but that did not fix the issue.

@flypylot

This comment has been minimized.

Show comment
Hide comment

+1

@Srednogorie

This comment has been minimized.

Show comment
Hide comment

+1

@tombusby

This comment has been minimized.

Show comment
Hide comment
@tombusby

tombusby Nov 26, 2016

It's ridiculous how long people have been +1ing this.

It's ridiculous how long people have been +1ing this.

@67Wq1x

This comment has been minimized.

Show comment
Hide comment

67Wq1x commented Dec 8, 2016

+1

@twang2218

This comment has been minimized.

Show comment
Hide comment
@twang2218

twang2218 Dec 9, 2016

Contributor

I love the have this feature, however, I didn't find any elegant approach to implement it.

The problem is caused by the DHCP in Virtualbox, if the system reboot, the DHCP server will lost all allocated IPs data, and try to reallocate the IP for those VM, which not likely to have the same IP for the last time.

I'm not sure it's right to let the Virtualbox to persistent the DHCP data. And Boot2docker will not persistent the IP allocated by DHCP, which is actually correct behavior.

IMHO, I don't think try to workaround the DHCP is the right way to do, I think adding the ability to specify a static IP to Boot2docker and docker-machine virtualbox driver should solve the problem.

It's maybe better to implement the static IP in https://github.com/boot2docker/boot2docker project first, such as, adding an ability to be specified a static IP, rather than using DHCP.

Here is the code to triggers DHCP call:

https://github.com/boot2docker/boot2docker/blob/master/rootfs/rootfs/bootscript.sh#L16

# Trigger the DHCP request sooner (the x64 bit userspace appears to be a second slower)
echo "$(date) dhcp -------------------------------"
/etc/rc.d/dhcp.sh
echo "$(date) dhcp -------------------------------"

We can make it conditional, by adding a set of IP configuration in /var/lib/boot2docker/profile, and if a static IP has been configured, then use the static IP instead of request IP from DHCP.

Then, we can add one or more options for virtualbox driver to specify the static IP configuration, such as --virtualbox-boot2docker-cidr, --virtualbox-boot2docker-gateway, --virtualbox-boot2docker-dns ...

Contributor

twang2218 commented Dec 9, 2016

I love the have this feature, however, I didn't find any elegant approach to implement it.

The problem is caused by the DHCP in Virtualbox, if the system reboot, the DHCP server will lost all allocated IPs data, and try to reallocate the IP for those VM, which not likely to have the same IP for the last time.

I'm not sure it's right to let the Virtualbox to persistent the DHCP data. And Boot2docker will not persistent the IP allocated by DHCP, which is actually correct behavior.

IMHO, I don't think try to workaround the DHCP is the right way to do, I think adding the ability to specify a static IP to Boot2docker and docker-machine virtualbox driver should solve the problem.

It's maybe better to implement the static IP in https://github.com/boot2docker/boot2docker project first, such as, adding an ability to be specified a static IP, rather than using DHCP.

Here is the code to triggers DHCP call:

https://github.com/boot2docker/boot2docker/blob/master/rootfs/rootfs/bootscript.sh#L16

# Trigger the DHCP request sooner (the x64 bit userspace appears to be a second slower)
echo "$(date) dhcp -------------------------------"
/etc/rc.d/dhcp.sh
echo "$(date) dhcp -------------------------------"

We can make it conditional, by adding a set of IP configuration in /var/lib/boot2docker/profile, and if a static IP has been configured, then use the static IP instead of request IP from DHCP.

Then, we can add one or more options for virtualbox driver to specify the static IP configuration, such as --virtualbox-boot2docker-cidr, --virtualbox-boot2docker-gateway, --virtualbox-boot2docker-dns ...

@pvlg

This comment has been minimized.

Show comment
Hide comment

pvlg commented Dec 23, 2016

+1

@mira-kovar

This comment has been minimized.

Show comment
Hide comment

+1

@fampat

This comment has been minimized.

Show comment
Hide comment

fampat commented Jan 25, 2017

+1

@ain

This comment has been minimized.

Show comment
Hide comment
@ain

ain Jan 25, 2017

Guys, come on. Could we please stop +1 on an obviously long-running issue? There was a Like button implemented for that particular reason. No need to spam the subscribers.

ain commented Jan 25, 2017

Guys, come on. Could we please stop +1 on an obviously long-running issue? There was a Like button implemented for that particular reason. No need to spam the subscribers.

@nevmerzhitsky

This comment has been minimized.

Show comment
Hide comment
@nevmerzhitsky

nevmerzhitsky Jan 26, 2017

No need to spam the subscribers.

You can unsubscribe.
1

nevmerzhitsky commented Jan 26, 2017

No need to spam the subscribers.

You can unsubscribe.
1

@tombusby

This comment has been minimized.

Show comment
Hide comment
@tombusby

tombusby Jan 26, 2017

@nathanleclaire

This comment has been minimized.

Show comment
Hide comment
@nathanleclaire

nathanleclaire Jan 26, 2017

Contributor

I'm all for spamming the subscribers.
Some of those subscribers are part of the project team.

Maintainer checking in. Please do not do spam the issue with +1 comments. This is a well known issue and spamming the thread doesn't do any good. Indicate support through the "+1" emoji reactions if you'd like. As always, we're happy to evaluate pull requests or detailed proposals. Thanks all.

(As a side note, @twang2218 seems to have the right idea generally -- static IPs are trickier than they look to get right and hit the use cases subscribers to this thread might have in mind -- perhaps an issue could be started in the boot2docker repo to discuss.)

Contributor

nathanleclaire commented Jan 26, 2017

I'm all for spamming the subscribers.
Some of those subscribers are part of the project team.

Maintainer checking in. Please do not do spam the issue with +1 comments. This is a well known issue and spamming the thread doesn't do any good. Indicate support through the "+1" emoji reactions if you'd like. As always, we're happy to evaluate pull requests or detailed proposals. Thanks all.

(As a side note, @twang2218 seems to have the right idea generally -- static IPs are trickier than they look to get right and hit the use cases subscribers to this thread might have in mind -- perhaps an issue could be started in the boot2docker repo to discuss.)

@aniljose72

This comment has been minimized.

Show comment
Hide comment
@aniljose72

aniljose72 Feb 26, 2017

I do not really want a static ip. But once the ip address is picked during creation, it should keep it on subsequent restarts. Is this already available?

I do not really want a static ip. But once the ip address is picked during creation, it should keep it on subsequent restarts. Is this already available?

@desimaniac

This comment has been minimized.

Show comment
Hide comment
@desimaniac

desimaniac Apr 2, 2017

I had a docker with VPN and the standard 192.168.99.100 wasn't loading. I figured this was because of the VPN connection, so I setup a bridge network inside Virtualbox to access the docker via 192.168.1.159. I would like this to show up on Kitematic's published IP address. Is there any way to do so?

desimaniac commented Apr 2, 2017

I had a docker with VPN and the standard 192.168.99.100 wasn't loading. I figured this was because of the VPN connection, so I setup a bridge network inside Virtualbox to access the docker via 192.168.1.159. I would like this to show up on Kitematic's published IP address. Is there any way to do so?

@joelhandwell

This comment has been minimized.

Show comment
Hide comment
@joelhandwell

joelhandwell Apr 3, 2017

For those who can not wait this feature to be implemented, assigning custom ip, plus custom cpu/memory is possible by using Vagrant VirtualBox provider and docker-machine generic driver.

For example in windows, place this Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = "AlbanMontaigu/boot2docker"
  config.vm.provider "virtualbox" do |v|
    v.memory = 8192
    v.cpus = 8
  end
  config.vm.synced_folder ".", "/vagrant", disabled: true
  config.vm.synced_folder "C:/Users", "/c/Users"
  config.vm.network "private_network", ip: "192.168.99.103"
end

and place vagrant default ssh private key with name vagrant.pem

and run

vagrant up
docker-machine create --driver generic --generic-ip-address=192.168.99.103 --generic-ssh-user=docker --generic-ssh-key=vagrant.pem default
docker-machine ls

and you'll get docker host with custom ip, cpu, memory etc configured via vagrant at the same time accessible via docker-machine.

You can find working file set for Windows in https://github.com/joelhandwell/dockerhost

joelhandwell commented Apr 3, 2017

For those who can not wait this feature to be implemented, assigning custom ip, plus custom cpu/memory is possible by using Vagrant VirtualBox provider and docker-machine generic driver.

For example in windows, place this Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = "AlbanMontaigu/boot2docker"
  config.vm.provider "virtualbox" do |v|
    v.memory = 8192
    v.cpus = 8
  end
  config.vm.synced_folder ".", "/vagrant", disabled: true
  config.vm.synced_folder "C:/Users", "/c/Users"
  config.vm.network "private_network", ip: "192.168.99.103"
end

and place vagrant default ssh private key with name vagrant.pem

and run

vagrant up
docker-machine create --driver generic --generic-ip-address=192.168.99.103 --generic-ssh-user=docker --generic-ssh-key=vagrant.pem default
docker-machine ls

and you'll get docker host with custom ip, cpu, memory etc configured via vagrant at the same time accessible via docker-machine.

You can find working file set for Windows in https://github.com/joelhandwell/dockerhost

joelhandwell added a commit to joelhandwell/dockerhost that referenced this issue Apr 10, 2017

@ahilbig

This comment has been minimized.

Show comment
Hide comment
@ahilbig

ahilbig Jul 10, 2017

@jcwilson Hi Josh et al, thanks a lot.. I forked your script in order to fix the same issue (see minishift/minishift#343 , minishift/minishift#598) in combination with minishift:

https://github.com/ahilbig/docker-machine-ipconfig

ahilbig commented Jul 10, 2017

@jcwilson Hi Josh et al, thanks a lot.. I forked your script in order to fix the same issue (see minishift/minishift#343 , minishift/minishift#598) in combination with minishift:

https://github.com/ahilbig/docker-machine-ipconfig

@mahnunchik

This comment has been minimized.

Show comment
Hide comment

Any news?

@gbraad

This comment has been minimized.

Show comment
Hide comment
@gbraad

gbraad Aug 23, 2017

Contributor

Currently, I am experimenting with this for Minishift: minishift/minishift#1293
Although, another approach would be to use something like cloud-init (which is maybe to heavy for this approach, or embed a DHCP server inside the Go-based binary and use this to force an allocated IP address)

Contributor

gbraad commented Aug 23, 2017

Currently, I am experimenting with this for Minishift: minishift/minishift#1293
Although, another approach would be to use something like cloud-init (which is maybe to heavy for this approach, or embed a DHCP server inside the Go-based binary and use this to force an allocated IP address)

@D33M

This comment has been minimized.

Show comment
Hide comment
@D33M

D33M Aug 25, 2017

+1.
Currently having more than one machine is horrific pain. If you use additional certificates (for example, for custom docker repository) and change order of starting machines, you have to do:

Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.100:2376"
: x509: certificate is valid for 192.168.99.101, not 192.168.99.100

This forces you to regenerate certificates or disable all machines and restore order of executing (what sometimes can be painful, too).

Additionally, using Chef to configure Docker-based project would also be much better if you could assume created machine would have always the same IP (for example, adding it to hosts file and you could forget about IPs).

D33M commented Aug 25, 2017

+1.
Currently having more than one machine is horrific pain. If you use additional certificates (for example, for custom docker repository) and change order of starting machines, you have to do:

Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates for host "192.168.99.100:2376"
: x509: certificate is valid for 192.168.99.101, not 192.168.99.100

This forces you to regenerate certificates or disable all machines and restore order of executing (what sometimes can be painful, too).

Additionally, using Chef to configure Docker-based project would also be much better if you could assume created machine would have always the same IP (for example, adding it to hosts file and you could forget about IPs).

@asishtom

This comment has been minimized.

Show comment
Hide comment

+1

@immutablelist

This comment has been minimized.

Show comment
Hide comment

+1

@luizhpriotto

This comment has been minimized.

Show comment
Hide comment
@luizhpriotto

luizhpriotto Sep 27, 2017

+1
thx jcwilson, the script docker-machine-ipconfig is very good! i needed to alter the eth1 to eth0 in the script, after this, the script working perfect for me. I'm use vmware vsphere.

bye.

luizhpriotto commented Sep 27, 2017

+1
thx jcwilson, the script docker-machine-ipconfig is very good! i needed to alter the eth1 to eth0 in the script, after this, the script working perfect for me. I'm use vmware vsphere.

bye.

@jeanpoelie

This comment has been minimized.

Show comment
Hide comment

+1

@gbraad

This comment has been minimized.

Show comment
Hide comment
@gbraad

gbraad Nov 27, 2017

Contributor

As part of minishift, we have implemented minishift/minishift#1316 and this has been working well so far. We are now looking into alternatives to do the same for the other hypervisors over time, but first we will fix the address using minishift/minishift#1457 (to prevent a new address from being assigned). We haven't been able to reserve time yet, we are going to land this in minikube too.

Contributor

gbraad commented Nov 27, 2017

As part of minishift, we have implemented minishift/minishift#1316 and this has been working well so far. We are now looking into alternatives to do the same for the other hypervisors over time, but first we will fix the address using minishift/minishift#1457 (to prevent a new address from being assigned). We haven't been able to reserve time yet, we are going to land this in minikube too.

@amoussa78

This comment has been minimized.

Show comment
Hide comment

+1

@maciekkreft

This comment has been minimized.

Show comment
Hide comment
@maciekkreft

maciekkreft Mar 11, 2018

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.

  1. Stop all VMs
    docker-machine stop ${docker-machine ls -q}
    This step will release all assigned addresses to VirtualBox DHCP

  2. 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.

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.

  1. Stop all VMs
    docker-machine stop ${docker-machine ls -q}
    This step will release all assigned addresses to VirtualBox DHCP

  2. 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.

@provodok

This comment has been minimized.

Show comment
Hide comment

provodok commented May 3, 2018

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment