When we enabled containers and Docker features on Windows Server 2016, a default network is created which is called nat
with IP prefix 172.16.0.0/12
. All the containers created inside the container host are created using this virtual network. Each of them have an adapter which is connected to a virtual switch over which inbound and outbound traffic is forwarded. Windows Server 2016, which comes with Docker daemon, might block you from creating new containers on a host and port even though there are no containers using the host's port. You might see an error similar to this:
C:\Program Files\Docker\docker.exe: Error response from daemon: failed to create endpoint condescending_albattani on net work nat: HNS failed with error : Failed to create endpoint.
In such cases run the following script on the container host which resets the Docker's container network. We'll be discussing Windows Containers networking more in later chapters:
Stop-Service docker...