Fixing “HNS failed with error : Unspecified error” on docker-compose for Windows

27 Feb, 2017
Xebia Background Header Wave

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.
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.

Marcel de Vries
Marcel is a key figure in the technology sector, serving as the co-founder and Global MD & CTO of Xebia Microsoft Services. He is deeply involved in advancing organizational capabilities to deploy software swiftly and securely, emphasizing the importance of innovation and productivity while maintaining compliance. Marcel is passionate about technology and continuous learning, often sharing his insights at leading industry events and through online courses on Pluralsight. Recognized for his contributions, Marcel has been honored with the Microsoft MVP award for over 17 consecutive years and is a Microsoft Regional Director since 2008. His expertise spans across Cloud Adoption Strategies, DevOps, and various cloud computing frameworks, making him a respected voice in the tech community.

Get in touch with us to learn more about the subject and related solutions

Explore related posts