Doesn’t work. Especially if, like me, you have a docking station usb 3 ethernet, an on-board ethernet, use wifi on many different access-points, and use your mobile phone for network connectivity.
The Docker daemon is started by running
net start docker
, which runs
C:\ProgramData\docker\runDockerDaemon.cmd
.
In that script, you’ll see the “virtual switch” (
docker daemon -D -b "Virtual Switch"
) is used for networking – and that (at least in my case) appears to be bound to the ethernet I had when I installed.
Same pain point as trying to use Hyper-V VM’s for roaming development.
Uninstalling Hyper-V leaves us in an interesting place:
ending build context to Docker daemon 2.048 kB Step 0 : FROM windowsservercore ---> 0d53944cb84d Step 1 : RUN @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" ---> Running in ad8fb58ba732 HCSShim::CreateComputeSystem - Win32 API call returned error r1=3224830464 err=A virtual switch with the given name was not found. id=ad8fb58ba732880aaace7b4e3288212aa9493083848cf0324de310520b523d21 configuration={"SystemType":"Container","Name":"ad8fb58ba732880aaace7b4e3288212aa9493083848cf0324de310520b523d21","Owner":"docker","IsDummy":false,"VolumePath":"\\\\?\\Volume{63828c05-49f4-11e5-89c2-005056c00008}","Devices":[{"DeviceType":"Network","Connection":{"NetworkName":"Virtual Switch","EnableNat":false,"Nat":{"Name":"ContainerNAT","PortBindings":null}},"Settings":null}],"IgnoreFlushesDuringBoot":true,"LayerFolderPath":"C:\\ProgramData\\docker\\windowsfilter\\ad8fb58ba732880aaace7b4e3288212aa9493083848cf0324de310520b523d21","Layers":[{"ID":"f0d4aaa3-c43d-59c1-8ad0-44e6b3381efc","Path":"C:\\ProgramData\\Microsoft\\Windows\\Images\\CN=Microsoft_WindowsServerCore_10.0.10514.0"}]}
looks like the virtual switch made for containers was removed at some point (might have been when I installed Hyper-V, I’m not sure)
Running
Get-VMSwitch
returns nothing.
So I installed VMWare Workstation and made a Boot2Docker VM with both NAT and private networking – both vmware based virtual networks continue to work when moving between wifi and ethernet.
So lets see if we can make one in powershell, using the VMWare NAT adaptor (see http://blogs.technet.com/b/heyscriptingguy/archive/2013/10/09/use-powershell-to-create-virtual-switches.aspx)
<
pre>
PS C:\Users\sven\src\WindowsDocker> Get-NetAdapter
Name InterfaceDescription ifIndex Status MacAddress LinkSpeed
—- ——————– ——- —— ———- ———
VMware Network Adapte…8 VMware Virtual Ethernet Adapter for … 28 Up 00-50-56-C0-00-08 100 Mbps
VMware Network Adapte…1 VMware Virtual Ethernet Adapter for … 27 Up 00-50-56-C0-00-01 100 Mbps
Wi-Fi Intel(R) Dual Band Wireless-AC 7260 4 Disabled 5C-51-4F-BA-12-6F 0 bps
Ethernet Intel(R) Ethernet Connection I218-LM 3 Up 28-D2-44-4D-B6-64 1 Gbps
VMWare helpfully provides a Virtual Network editor, so I can see that “Get-NetAdapter -Name “VMware Network Adapter VMnet8” is the NAT one. I’m not sure if creating a Hyper-V External vswitch will make exclusive use of the adaptor, but if so, we can always create another 🙂
PS C:\Users\sven\src\WindowsDocker> New-VMSwitch -Name "VMwareNat" -NetAdapterName "VMware Network Adapter VMnet8" -AllowManagementOS $true -Notes "Use VMnet8 to create a roamable Docker daemon network" Name SwitchType NetAdapterInterfaceDescription ---- ---------- ------------------------------ VMwareNat External VMware Virtual Ethernet Adapter for VMnet8
now to edit the runDockerDaemon.cmd, and restart the Docker Daemon.
FAIL. the docker containers still have no network. At this point, I’m not sure if I’ve totally broken my Windows Docker networking, hopefully some more playing later will turn up something.
Playing some more, there seems to be a new switchtype Nat – see https://raw.githubusercontent.com/Microsoft/Virtualization-Documentation/master/windows-server-container-tools/Install-ContainerHost/Install-ContainerHost.ps1
So re-running the command they use when installing gets us something new to try:
PS C:\Users\sven\src\WindowsDocker> new-vmswitch -Name nat -SwitchType NAT -NatSubnetAddress "172.16.0.0/12" Name SwitchType NetAdapterInterfaceDescription ---- ---------- ------------------------------ nat NAT PS C:\Users\sven\src\WindowsDocker> Get-VMSwitch Name SwitchType NetAdapterInterfaceDescription ---- ---------- ------------------------------ VMwareNat External VMware Virtual Ethernet Adapter for VMnet8 nat NAT
it works when the ethernet is plugged in, but not on wifi.
yup – bleeding edge dev 🙂