robbertkl / docker-ipv6nat

Extend Docker with IPv6 NAT, similar to IPv4
MIT License
662 stars 48 forks source link

Dealing with containers that map specific IP address #57

Closed ginkel closed 4 years ago

ginkel commented 4 years ago

Hi there,

I recently added an extra IP address to some of my servers so I can have multiple containers listening on the same port. Is there a way to expose one of them via IPv6. Previously, I used to have -p 443:443, which worked fine, now I have -p 1.2.3.4:443:443, which no longer gets exposed via IPv6.

Any hints are much appreciated!

ginkel commented 4 years ago

Just noticed this might be related to #48

robbertkl commented 4 years ago

Correct, this is currently not supported, as the Docker cli has no support for IPv6 addresses in the -p argument. We'll need to have a separate mapping for that, but I'm not yet sure if #48 is the way to go.

bephinix commented 4 years ago

Currently the only options is to specify the IPv6 addresses manually with -p [fe80::1]:443:443.

ginkel commented 4 years ago

Currently the only options is to specify the IPv6 addresses manually with -p [fe80::1]:443:443.

# docker run -it --rm -p '[fe80::1]:80:80' nginx
docker: Error response from daemon: driver failed programming external connectivity on endpoint sad_ride (5cf2fd827d91d07f88a6a6a69c35abea47f5912722eead82b70ecdfcffefdd83): listen tcp [fe80::1]:80: bind: invalid argument.
ginkel commented 4 years ago

Things seem to look better if I use the public IPv6 address of the host, though

bephinix commented 4 years ago

@ginkel
Sorry, if you want to use fe80::/64 you need to specify the interface. The following should work:

docker run -it --rm -p '[::1]:80:80' nginx
bephinix commented 4 years ago

@robbertkl We can close this.