I am trying to attach a container to two subnets, without success.
This piece of information reports that cross subnet communication is not currently supported: https://learn.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/container-networking
However, I have defined two custom NAT subnetworks within the large default NAT network.
When starting the container, everything looks okay: There are two virtual NIC inside the container with appropriate IP-addresses. However, I can ping only one of the interfaces from the host and containers in the respective subnets.
Is this currently supported, and supposed to work?
It might be an option to route between two segregated subnets, is that currently doable with Docker for Windows?
I have tried two approaches for network creation:
1. with docker-compose:
version: '2.1'
services:
rabbitmq-c:
image: ephortesys/rabbitmq:latest
hostname: rabbitmq-c
domainname: gecko.no
mem_limit: 1g
networks:
- internal
- external
networks:
internal:
driver: nat
driver: default
ipam:
config:
- subnet: 172.24.1.0/24
gateway: 172.24.1.1
external:
driver: nat
ipam:
driver: default
config:
- subnet: 172.24.2.0/24
gateway: 172.24.2.1
**
2. with 'docker network create', and use these in docker.compose.yml:
docker network create --driver=nat --subnet=172.24.1.0/24 --gateway=172.24.1.1 net1
docker network create --driver=nat --subnet=172.24.2.0/24 --gateway=172.24.2.1 net2
networks:
internal:
external:
name: "net1"
external:
external:
name: "net2"
Some more info:
C:\WINDOWS\system32> Get-NetNat
Name : SharedNAT
ExternalIPInterfaceAddressPrefix :
InternalIPInterfaceAddressPrefix : 172.24.0.0/20
IcmpQueryTimeout : 30
TcpEstablishedConnectionTimeout : 1800
TcpTransientConnectionTimeout : 120
TcpFilteringBehavior : AddressDependentFiltering
UdpFilteringBehavior : AddressDependentFiltering
UdpIdleSessionTimeout : 120
UdpInboundRefresh : False
Store : Local
Active : True
C:\WINDOWS\system32> docker info
Containers: 1
Running: 1
Paused: 0
Stopped: 0
Images: 18
Server Version: 17.03.1-ce
Storage Driver: windowsfilter
Windows:
Logging Driver: json-file
Plugins:
Volume: local
Network: l2bridge l2tunnel nat null overlay transparent
Swarm: inactive
Default Isolation: hyperv
Kernel Version: 10.0 14393 (14393.1066.amd64fre.rs1_release_sec.170327-1835)
Operating System: Windows 10 Enterprise
OSType: windows
Architecture: x86_64
CPUs: 8
Total Memory: 63.84 GiB
Name: PC36144
ID: QYSA:VJE6:OM5A:EJE2:MFJ6:4XLV:UCDN:UTRF:TL5K:IWOO:O2O2:Y6Z3
Docker Root Dir: C:\ProgramData\Docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: -1
Goroutines: 30
System Time: 2017-05-04T10:02:36.9325341+02:00
EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
C:\WINDOWS\system32> docker version
Client:
Version: 17.03.1-ce
API version: 1.27
Go version: go1.7.5
Git commit: c6d412e
Built: Tue Mar 28 00:40:02 2017
OS/Arch: windows/amd64
Server:
Version: 17.03.1-ce
API version: 1.27 (minimum version 1.24)
Go version: go1.7.5
Git commit: c6d412e
Built: Tue Mar 28 00:40:02 2017
OS/Arch: windows/amd64
Experimental: true