Mastering Windows Server 2016 Hyper-V

(Romina) #1
Windows administrators  rarely  pay any attention   to  case,   because Windows is
case insensitive. Linux, on the other hand, is case sensitive, and because Docker
started out in Linux, it is case sensitive also. Therefore, you should be careful
about the case of objects, resource types, and parameters when using docker.exe.
The wrong case will not work, and errors will not be obvious.

The Docker client command to create a new NAT network follows. In this example,
the subnet used for the NAT is 172.16.1.0/24 with a name of NatNetwork1:


docker network create -d nat --subnet=172.16.1.0/24 NatNetwork1


Once the network is created, look at the network adapters on the container host and
you will notice that an HNS internal NIC has been added. If you install the Hyper-V
Manager, you will see that a new internal network has been added that matches the
name of the network specified.


To view available networks, use either docket network ls or Get-ContainerNetwork.
You will notice that an existing NAT network is already present. This is created for
Docker when starting the service. If you do not want the default NAT network to be
created, use the "bridge":"none" option in
C:\programdata\docker\config\daemon.json, as I cover later in this section. To get
more detail about a network, use the inspect parameter. For example:


PS C:> docker network inspect NatNetwork1
[
{
"Name": "NatNetwork1",
"Id": "66662a657b107a275cf0be76c4824f5a2ac0d0d7ff4aefe89ac34979e6a2e0e6",
"Scope": "local",
"Driver": "nat",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "172.16.1.0/24"
}
]
},
"Internal": false,
"Containers": {},
"Options": {
"com.docker.network.windowsshim.hnsid": "a34a64a6-a0af-4d46-
b536-feeb611098b7"
},
"Labels": {}
}
]


I previously mentioned that a default NAT network exists that is created automatically

Free download pdf