Hello,
I’m currently testing the Windows Server 2016 RC with Docker. I am trying to setup multiple containers with the same external port on different ip addresses but I can’t get it work.
My network setup on the container host contains multiple IPv4 addresses. For example:
192.168.1.100
192.168.1.101
192.168.1.102
I’ve trying to startup multiple containers on the node. Some of them with different ports and some of them with the same port. But Docker binds the ports by default to 0.0.0.0 (any ip) which makes it impossible to bind the same port multiple times. But it seems like it’s not supported:
docker run -ti -p 192.168.1.102:27015:27015/udp microsoft/windowsservercore cmd.exe
docker: Error response from daemon: failed to create endpoint hopeful_montalcini on network nat: Windows does not support host IP addresses in NAT settings.
What can I do?
-
Using a different network driver? But then I can’t share the same ip over multiple containers and I also can’t use the IP on the container node itself.
-
Is there a way to overwrite the IP binding with the NAT driver? Windows should support this normally. See:
PS C:\Users\Administrator> Get-NetNatStaticMapping
StaticMappingID : 3
NatName : Hdf6a3403-c446-4b64-98fb-035dbe2c7fac
Protocol : UDP
RemoteExternalIPAddressPrefix : 0.0.0.0/0
ExternalIPAddress : 0.0.0.0 < this should be changeable? >
ExternalPort : 27015
InternalIPAddress : 172.30.132.47
InternalPort : 27015
InternalRoutingDomainId : {00000000-0000-0000-0000-000000000000}
Active : True
Edit: I’ve created a feature request on Github.
Regards,
Alexander