robbertkl / docker-ipv6nat

Extend Docker with IPv6 NAT, similar to IPv4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dealing with containers that map specific IP address

ginkel opened this issue · comments

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!

Just noticed this might be related to #48

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.

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

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.

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

@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

@robbertkl We can close this.