HNS problems - Docker for Windows Server 2019 - hnsCall failed in Win32: You were not connected because a duplicate name exists on the network. If joining a domain, go to System in Control Panel to change the computer name and try again. If joining a work

Hi, often we have problems with HNS errors on our Docker Host for serveral windows process isolated docker containers.

My problem was, that one of the containers doesn’t start, because hns32 says:

failed during hnsCallRawResponse: hnsCall failed in Win32: The process cannot access the file because it is being used by another process. (0x20)

That basically means (now I know) that one of the ports the containers uses are already in use…

But then I do my HNS docker thing…

stop docker
stop hns
rename hns.data under programdata
start hns
start docker

Often it does the thing…

But now it says the following, when it tries to start the docker service:

fatal: failed to start daemon: Error initializing network controller: Error creating default network: failed during hnsCallRawResponse: hnsCall failed in Win32: You were not connected because a duplicate name exists on the network. If joining a domain, go to System in Control Panel to change the computer name and try again. If joining a workgroup, choose another workgroup name. (0x34)

And it doesn’t comes up and you can’t really do a thing without the docker daemon… docker network ls doesn’t work without the daemon.

I can’t restart the whole windows machine, because there are running other services that are needed.

And I found nothing on the internet docker related… The only things i found was for Windows XP.

System: Server 2019 1809 Build: 17763.2300
I’ve installed the docker-msftprovider, the latest version a month ago.
The system is running in Azure and provides serveral containers over NAT.
So the people are using the container services through the docker host ip and using then the ports.

Can anyone help me?
These hns errors under windows… HORROR.

Thank you for your help!

best regards,
Robin

I’ve had a fixed cidr in the daemon-file under:

C:\ProgramData\docker\config

after I’ve deleted the CIDR for the network, the docker daemon starts again…

But my problem with the container is already there:

failed to create endpoint ***************** on network nat: failed during hnsCallRawResponse: hnsCall failed in Win32: The process cannot access the file because it is being used by another process. (0x20)

netstat -aon | findstr 50000
PS C:\windows\system32> netstat -aon | findstr 50001
PS C:\windows\system32> netstat -aon | findstr 50005
PS C:\windows\system32> netstat -aon | findstr 50006
PS C:\windows\system32> netstat -aon | findstr 50007
PS C:\windows\system32> netstat -aon | findstr 50008
PS C:\windows\system32> netstat -aon | findstr 50009

Doesn’t bring anything up. So why the heck it is not starting?

Now I rebuild the container under 60000. And it works. Why netstat doesn’t find these port blocks?