moby / libnetwork

networking for containers
Apache License 2.0
2.16k stars 881 forks source link

fix port forwarding with ipv6.disable=1 #2635

Closed AkihiroSuda closed 3 years ago

AkihiroSuda commented 3 years ago

Make docker run -p 80:80 functional again on environments with kernel boot parameter ipv6.disable=1.

Fix moby/moby#42288 fixes https://github.com/moby/libnetwork/issues/2629 Network issue with IPv6 following update to version 20.10.6


Tested on Ubuntu 21.04.

Previously, docker run -p 80:80 with ipv6.disable=1 was failing with an error: docker: Error response from daemon: driver failed programming external connectivity on endpoint naughty_moore (038e9ed4b5ea77e1c52462d6d04ad001fbad9beb185a6511aadc217c8a271608): Error starting userland proxy: listen tcp6 [::]:80: socket: address family not supported by protocol.

AkihiroSuda commented 3 years ago

@moby/libnetwork @thaJeztah @tiborvass PTAL

arkodg commented 3 years ago

https://github.com/moby/libnetwork/blob/b5dc37037049d9b9ef68a3c4611e5eb1b35dd2af/drivers/bridge/port_mapping.go#L118 might be a better place to reuse some of the validation above and then check IsV6Listenable

AkihiroSuda commented 3 years ago

Help wanted for testing.

Anyway, would it be possible to release v20.10.7 to provide the quick fix, and revisit the testing plan later? cc @thaJeztah @tiborvass

thaJeztah commented 3 years ago

@AkihiroSuda could you have a look at @arkodg 's suggestion? If we're able to move the check inside that function, we can probably add a unit test for it at least

thaJeztah commented 3 years ago

@cpuguy83 @arkodg ok with you to merge this?

thaJeztah commented 3 years ago

let me bring this one in and open a vendor PR in moby