-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Allow '--link' with '--network bridge' #5739
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5739 +/- ##
==========================================
+ Coverage 59.04% 59.42% +0.38%
==========================================
Files 344 347 +3
Lines 29391 29402 +11
==========================================
+ Hits 17353 17472 +119
+ Misses 11064 10958 -106
+ Partials 974 972 -2 |
Thanks! I'll probably need to dig into this one again 🙈 ISTR there was some hairy logic where options for the default network had to be passed to old structs (for compatibility with older daemons), and any network after that to be passed through network-options. And then, there were non-legacy |
Oh, there's a non-legacy In that case, perhaps the fix here should be in |
Yeah, there is; when we reimplemented networks using the embedded DNS, we kept docker network create mybridge
docker run -d --rm --network=mybridge --name webserver nginx:alpine
docker run -it --rm --network=mybridge --link webserver:webbie nginx:alpine ping webbie
PING webbie (172.19.0.2): 56 data bytes
64 bytes from 172.19.0.2: seq=0 ttl=64 time=0.783 ms
64 bytes from 172.19.0.2: seq=1 ttl=64 time=0.125 ms
64 bytes from 172.19.0.2: seq=2 ttl=64 time=0.153 ms
^C
--- webbie ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.125/0.353/0.783 ms |
Right - yes - I see it adds an alias ... https://github.com/moby/moby/blob/d7ad7a9534afb673fcbb6dabb64bae3be720e2b8/daemon/network.go#L1121-L1127 That makes sense - I'll fix this fix. |
bdde2be
to
e1f6e74
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed during our 1-1, it'd be great to add a test for that.
The '--link' option should only be migrated to an endpoint option if the network is user-defined ... there was already an exception for network "default", but not for "bridge". Signed-off-by: Rob Murray <rob.murray@docker.com>
e1f6e74
to
2c35778
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM; but would appreciate review from @akerouanton :)
- What I did
Commit f1048e1 ("Create default EndpointSettings if no --network provided") added an exception for
default
inapplyContainerOptions()
... so that--link
isn't copied to endpoint settings if it's a legacy-link option for the default bridge.But, that missed "--network bridge", or the long form "--network name=bridge,..." (needed to specify endpoint options).
- How I did it
Check for
IsUserDefined
instead of!= "default
.- How to verify it
docker run --rm -ti --network name=bridge,driver-opt=com.docker.network.endpoint.sysctls=net.ipv6.conf.IFNAME.disable_ipv6=1 --name c1 busybox
works with this change.- Description for the changelog