As already stated in Docker Containers on Windows 10: HNS failed with error: unspecified error, there are some issues with Docker on Windows machines. I went away from using Windows 10 as the host machine for Containerization with Docker, it didn’t look very stable and for a productive system it anyway is not feasible.
I worked about one and a half month, never experienced the issue with Windows Server 2016. Actually it looks like, I can hit the problem everywhere.
Windows Server 2016 with Containers automatic shutdown
The machine where the issue comes up was an Azure VM. The template I used was that one:
Azure has some kind of cost safety functionality that shuts down VMs over night (whatever that means regarding the fact that Azure can be used from different time zones). I guess the shut down mechanism is configurable somewhere, I didn’t have a look. Actually that feature was pretty welcome as it really saves some money. It has a not-so-welcome drawback. When the machine shuts down, I am not sure if docker, Hyper V and Containerization do shutdown gracefully.
Same issue as with Windows 10
It is not possible to solve the issue on a Windows Server 2016 machine with the instructions in Docker Containers on Windows 10: HNS failed with error: unspecified error. The template has pre-installed the Hyper-V and Containers, so there is no way to unselect therefore uninstall these features.
Hyper-V is disabled…
…as well as Container feature is.
So uninstalling Containers, Hyper-V and afterwards Docker and then reinstall everything will not be possible.
Anyway, I did find another way for solving the issue. Microsoft Docs contain a powershell script that promises to clean up container host environments. Find the script here on github. This line will lead to the rescue:
PS C:\> .\WindowsContainerNetworking-LoggingAndCleanupAide.ps1 -Cleanup -ForceDeleteAllSwitches
The machine was restarted twice, afterwards when trying to start a container with Docker Run it does work again.
The question I do have to ask myself is:
How stable is docker on Windows?
I really do not want to hit this issue in production.