Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
1.9: Default docker0 IP is not 172.17.42.1 for new installs #17305
Comments
vdemeester
added
the
kind/question
label
Oct 23, 2015
vdemeester
added this to the 1.9.0 milestone
Oct 23, 2015
|
ping @mavenugo @tiborvass |
|
Couple of things to clarify. Any existing running docker system upgraded to 1.9.0 will retain whatever existing docker0 ip is. So, if it is @ibuildthecloud @tiborvass we went back and forth on this one too. Its hard to argue with @ibuildthecloud 's grounded view on the reality. I do agree that if someone hardcoded with this ip, they will know when their IMO, Encouraging such behaviour is more harmful than providing a patch for this. Just fyi, we already have a patch for this : docker/libnetwork#649 which am very reluctant to approve. |
ibuildthecloud
changed the title from
1.9: Default docker0 IP is not 172.17.42.1
to
1.9: Default docker0 IP is not 172.17.42.1 for new installs
Oct 23, 2015
|
@mavenugo If a machine reboots, which IP will be assigned. On most systems docker0 is created by Docker itself. How does an upgraded setup know to keep the bridge IP as 172.17.42.1 after reboot? |
|
@ibuildthecloud if the docker0 bridge persists (which it does) upon reboot, then the docker daemon reads the bridge IP first and use it before allocating something on its own. |
|
@mavenugo That's what I don't get, docker0 doesn't persist on reboot, right? The daemon creates it on the vast majority of systems I see. How is it persisted? Does the deb/rpm's do something to create unit files for the bridge interface. |
|
@mavenugo For the record, I confirm that after a server restart (and |
|
@ibuildthecloud Why should docker try to persist with the same IP for docker0 when user hasn't asked anything specifically? What need does it fulfill? I am not asking this rhetorically. I would like to understand what need does it fulfill to have a sticky IP address(or what problem does it cause if it is not sticky). We would like to avoid all these magic IP address values as much as possible which is becoming a major maintenance problem for us. BTW, if the user wants his docker0 IP to persist he can always stick in his favorite |
|
@tiborvass @ibuildthecloud yes. i stand corrected on the docker0 bridge creation on machine reboot. got carried away with the daemon restart vs machine reboot. Regardless of that, I still dont think it is a good idea to encourage this. |
|
I suggest to fix this with a documentation update, and possibly a daemon info log that tells which ip was used. |
|
For what it's worth, we have The easiest method, I guess, would be to take your own IP and set the last octet to 1, but that doesn't work with host networking, where If this IP is not hardcoded anymore, it's somewhat difficult to reliably determine the host's IP address. I guess you could introspect on the net namespace, using your own IP if it's the root ns, and clobbering the last octet if it's not? Or perhaps we just have to pass in the bridge IP via an environment variable now? Our use-case is that we run some telemetry relay services on each host machine. |
|
@burke You should be able to look up your default gateway IP inside the container and whatever IP that is, is the IP that you can use to talk to the host. Does that work? It's lot better than hardcoding Fo detecting whether you are in host net namespace you can look for the presence of docker0 bridge inside the container. If it is present then you can simply pick docker0's IP address. So to me, I don't think we need a special container<->host api to achieve this. |
|
Asking for the gateway works as long as the container knows it's running in a network namespace:
The former is correct, but the latter is our network hardware. To work around this, I have to either tell my containers whether they're running with host networking, or teach them the subnets we use in our datacenters so that they can go "aha, this is DC X, not a docker virtual network, so I will use my own IP, not my gateway, to talk to the host". To be clear, this issue isn't a huge dealbreaker for me -- I can just pass yet another environment variable into the container -- but I think it would be valuable for the containerized app to have a predictable way of routing to its host. |
|
@burke @ibuildthecloud But you can use |
|
Oh! I missed that. Sorry, disregard, that'll work just fine. |
mavenugo
referenced this issue
Oct 26, 2015
Merged
Simple Info log to indicate the chosen IP Address for the default bridge #17384
|
As discussed, docker#17384 adds the required info log to the user to notice and take action if required. (I hope there isnt anyone who relies on these magic ip-addresses) |
|
Closed by #17384 |
tiborvass
closed this
Oct 26, 2015
|
Fairwell |
|
@ibuildthecloud feel free to resuscitate it with |
|
I will :) |
thaJeztah
referenced this issue
in docker/compose
Oct 30, 2015
Closed
Resolve links set as DNS to their ip address. #1138
|
@tiborvass not sure where we should add this to the documentation, but would it be good to mention in the release notes? |
added a commit
to djmaze/twister-core
that referenced
this issue
Nov 11, 2015
added a commit
to djmaze/twister-core
that referenced
this issue
Nov 11, 2015
This was referenced Nov 11, 2015
luebken
commented
Dec 11, 2015
Well it's to late for the release notes. ;-) But a +1 for documenting the change itself somewhere. I also would like to learn more about the reasoning. |
wesleymusgrove
commented
Jan 29, 2016
|
@ibuildthecloud, can you point me to any documentation for how to use Unfortunately this change bit me because I'm behind a corporate firewall and must use SSH tunneling to port forward traffic from 172.17.42.1 to a proxy. I didn't expect this to change so I hardcoded 172.17.42.1 all over the place in my project's code, environment variables, etc... Thanks! |
|
@wesleymusgrove Pls refer to https://github.com/docker/docker/blob/e44364eae90784b423eee8b2969bda9cd2429746/man/docker-daemon.8.md#options. The documentation for the |
wesleymusgrove
commented
Jan 29, 2016
|
Thanks @mavenugo! |
|
@wesleymusgrove please make sure the flag |
wesleymusgrove
commented
Jan 29, 2016
|
Thanks again @mavenugo! On Ubuntu 14.04 setting |
marun
referenced this issue
in openshift/origin
Feb 23, 2016
Merged
Fix router e2e validation for docker 1.9 #7574
vmatekole
commented
Mar 27, 2016
|
Today one our CoreOS clusters went down in production due to this change. Consul failed to start, as a result all services were unable to be discovered. It appears this may have come about after a leader host was rebooted and switched over to a later version of docker via a CoreOS update. Docker daemon in CoreOS is normally configured via cloud-config which is immutable... The cluster had to be rebuilt with a new config forcing the gateway to be set at the original 172.17.42.1 as per above. I'm not sure how we can avoid hard coding the gateway IP in cloud config... Nonetheless, it's unfortunate this had to change to cause us a costly downtime. |
|
@vmatekole as discussed in this thread, its a bad practice to depend on |
vmatekole
commented
Mar 27, 2016
|
@mavenugo I understand this is now stipulated but it appears the docker ecosystem incl. Consul and CoreOS fail to indoctrinate or evangelise this practice, at least from what I can ascertain. And I have never come across this in documentation, even the link - https://docs.docker.com/engine/admin/configuring/ you provide on this practice, appears to have the info buried in a place that I can't find.... I understand no guarantees were made but there was little warning either and as such, practices have followed suit... |
MrMMorris
commented
Mar 28, 2016
|
Found this issue when I realized my docker containers weren't resolving Consul dns after moving from 1.6.2 to 1.9.1. I was using My question is, should I set |
|
@MrMMorris its not a good idea to depend on any such magic IPs. If you have to depend on such an IP, it must be specified via |
MrMMorris
commented
Mar 28, 2016
|
@mavenugo well from what I remember, the only reason I initially set |
wkruse
commented
Apr 7, 2016
|
As @MrMMorris I am using |
MrMMorris
commented
Apr 7, 2016
|
I am not able to get consul DNS to work inside containers without @mavenugo if you say "its not a good idea to depend on any such magic IPs", do you know why DNS inside containers does not work? I thought they just inherited the settings from the host. I am using dnsmasq and I have it set up to accept connections from |
ibuildthecloud commentedOct 23, 2015
I've gone back and forth on this one, but I do think that Docker should stick with the default docker0 IP as 172.17.42.1. On the one hand plenty will say that nobody should have never hardcoded that IP, but then on the other hand, you know people probably have.
Issues will most likely come in after 1.9 is released where the root cause will be discovered to be that the user assumed 172.17.42.1 somewhere. While the user would be at fault there is still two down sides to this. 1) The time it takes to support these issues. 2) the experience and frustration of the user that something in Docker changed and now X doesn't work.
I don't really think it's worth it to stick to the ideals that nobody should hard code this IP.
Okay, I gave my two cents.