Home > docker > –net=Host option not recognized under Windows 2016 CTP4

–net=Host option not recognized under Windows 2016 CTP4


Hi again,

After docker on Linux, I was playing with the new Windows containers using docker engine.

Before starting, I explain quickly my environment; I have deployed a virtual machine based on Windows Server Core CTP4 and I deployed the containers feature on it. By default the script used to provision a container host “Install-ContainerHost.ps1” creates a virtual switch named Virtual Switch using the NAT connection type; finally this feature is available! Before, we was obliged to use the routing services into an other virtual machine for example.

VSwitch

On Linux I was able to create my containers using the same network stack as my host. So I had just to create ports forwarding rules from my host to my container. To achieve this goal we use –net=Host option.

I created a container from the WindowsServerCore image using this command:

ContError

However this option is not accepted. How to configure my docker network?

Under Windows, a file named “runDockerDaemon.cmd” located under c:\ProgramData\docker folder defines the default VSwitch to use when creating containers.

runDocker

As expected, the “Virtual Switch” switch is defined by default. If you want to use an external vswitch, you have just to define it in the runDockerDaemon file.

@echo off
set certs=%ProgramData%\docker\certs.d

if exist %ProgramData%\docker (goto :run)
mkdir %ProgramData%\docker

:run
if exist %certs%\server-cert.pem (if exist %ProgramData%\docker\tag.txt (goto :secure))

docker daemon -D -b “Virtual Switch”
goto :eof

:secure
docker daemon -D -b “Virtual Switch” -H 0.0.0.0:2376 –tlsverify –tlscacert=%certs%\ca.pem –tlscert=%certs%\server-cert.pem –tlskey=%certs%\server-key.pem

According to Microsoft, “Each container needs to be attached to a virtual switch in order to communicate over a network. A virtual switch is created with the New-VMSwitch command. Containers support a virtual switch with type External or NAT"

I think that with VSwitches containers manage their own networks stacks. An overhead is created consequently. Under Linux, we can bypass this layer and use the host network stack directly.

 

Advertisements
Categories: docker Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: