The past few days I worked quite a lot with docker-compose on my windows machine and after something strange happened to my machine that crashed it, I was not able to start any containers anymore that had connectivity over the network with each other.

Every time I used the command-line docker-compose up, I would get a message telling me it failed to start the container. the full message I got was:

“ERROR: for web  Cannot start service web: failed to create endpoint aspnetblogapplication_web_1 on network nat: HNS failed with error : Unspecified error”

Some searches on the internet gave me options where I needed to reset some of my network configuration using PowerShell. Most of these posts refer to Technical Preview 5 of Windows Server 2016, but I am now running these containers on windows 10 anniversary edition.

— Edit —

if you are running Visual Studio 2017 and you added the services to the yaml files using the “add docker support” option, first check that it did not duplicate the port numbers. If you have two web applications and you add them both, they both get port 80 assigned. The error message you will get is the same, HNS failed with error: Unspecified

— end Edit —

The way to solve the issue was rather simple, but overlooked by most people it seems. And it is not mentioned anywhere as the solution to this problem.

If you go to the tray icon and open the tool, there is an option called Reset

reset docker settings

If you select to the factory defaults, it will also reset the things that cause the problem and your Docker tools work again. I must say I have no clue what caused the problem, but this was the only solution that works like a charm.

Only nasty side effect is that it also resets all your local images, so all images you pulled or build on your local machine will be removed and need to be fetched again or rebuild.

CTO at Xpirit, Microsoft Regional Director, Visual studio ALM MVP, Speaker, Pluralsight Author and IT Architect Consultant