moby / moby

The Moby Project - a collaborative project for the container ecosystem to assemble container-based systems
https://mobyproject.org/
Apache License 2.0
68.59k stars 18.64k forks source link

Cannot attach a docker network to an existing Virtual Switch #29067

Open Attil opened 7 years ago

Attil commented 7 years ago

Hi,

Description

I cannot make docker use a virtual switch that I've set up earlier, using Hyper-V Manager.

I've used a few different approaches to achieve this

Is there any procedure to follow to use an existing (ie. created before even installing docker) virtual switch? Could it be achieved by writing a custom network driver?

Output of docker version:

Client:
 Version:      1.14.0-dev
 API version:  1.26
 Go version:   go1.7.3
 Git commit:   e308f6b
 Built:        Tue Nov 22 18:15
 OS/Arch:      windows/amd64

Server:
 Version:             1.14.0-de
 API version:         1.26
 Minimum API version: 1.24
 Go version:          go1.7.3
 Git commit:          e308f6b
 Built:               Tue Nov 2
 OS/Arch:             windows/a
 Experimental:        false

Output of docker info:

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 1
Server Version: 1.14.0-dev
Storage Driver: windowsfilter
 Windows:
Logging Driver: json-file
Plugins:
 Volume: local
 Network: l2bridge l2tunnel nat null overlay transparent
Swarm: inactive
Default Isolation: process
Kernel Version: 10.0 14393 (14393.447.amd64fre.rs1_release_inmarket.161102-0100)
Operating System: Windows Server 2016 Standard
OSType: windows
Architecture: x86_64
CPUs: 3
Total Memory: 7.999 GiB
Name: WIN-Q5MC9ANPA79
ID: RO43:AQ2A:5TOP:7BF3:KTES:K4BR:RXH5:LWX6:KNUW:WHEM:JOVP:7DFS
Docker Root Dir: C:\ProgramData\docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Additional environment details (AWS, VirtualBox, physical, etc.): Tried it twice: on a physical machine and on a Hyper-V machine with nested virtualization enabled. Neither worked.

cpuguy83 commented 7 years ago

ping @johnstep

johnstep commented 7 years ago

I will look into this today.

johnstep commented 7 years ago

Apologies for the delay, but I will provide an update today. Thanks!

johnstep commented 7 years ago

Unfortunately, it looks like this is currently hard-coded for Windows. @mavenugo, do you know there is a way to work around this issue, or if there is a plan to improve this?

mback2k commented 6 years ago

I am also running into this issue. I have to pre-create the VMSwitches, because they require custom routing information which would be lost from the interfaces if Docker created them and cause Docker to loose Swarm connectivity. Loosing connectivity to the Swarm causes Docker to go into an endless loop of creating the networks, breaking routing, loosing connectivity, deleting everything, connecting to Swarm and starting all over again.

@johnstep Would it be possible to get support for something like "com.docker.network.windowsshim.vmswitch" for overlay and transparent network types?

m-kostrzewa commented 6 years ago

I presume this would have to be added to HNS (docker uses the golang shim available at https://github.com/microsoft/hcsshim; afaik all the Get/New...-ContainerNetwork cmdlets talk directly to HNS as well).

@mavenugo do you know if support of this is in Microsoft's plans for docker?