robbertkl / docker-ipv6nat

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

Allow mapping IPv4 listen addresses to IPv6 #48

Open mildred opened 4 years ago

mildred commented 4 years ago

When port mapping is defined in Docker, it might be specifying a HostIP in addition to the HostPort. If the HostIp is defined, it's generally an IPv4 address. it might be great to have docker-ipv6nat be able to convert automatically the IPv4 listen addresses to IPv6 based on some mapping.

The use case is to work with the Nomad scheduler which automatically detect the HostIP based on network detection on the host. it does not support IPv6 there, and it might not be in the future as docker itself does not support IPv6 port mapping.

Suggested CLI flag: -map-ipv4=192.168.3.0/24=2001:912:1480:11::226,... (for example)

I can provide a PR for that

bephinix commented 4 years ago

@robbertkl AFAIK, Docker-IPv6NAT should only mirror Docker's own IPv4 behaviour to IPv6. I think, this is not a part of Docker-IPv6NAT. What do you think?

robbertkl commented 4 years ago

I'm a bit on the fence on this one. You're right, the mapping is not part of Docker itself. However, the functionality of binding to an IP address is available in Docker but cannot be mirrored properly by docker-ipv6nat. This suggests a way to still be able to do it.

There's an associated PR as well (#50), but did not have time yet to look into it.