Docker containers on Windows Server 2016 with Containers: HNS failed with error: Unspecified error

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-windows-server-2016-template

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…

turn-windows-features-off-windows-server-hyper-v

…as well as Container feature is.

turn-windows-features-off-windows-server-containers

So uninstalling Containers, Hyper-V and afterwards Docker and then reinstall everything will not be possible.

Solution

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.

One Comment

  1. David Pavel said:

    Hi,
     
    We just wanted to let you know that the domain codingsoul.net is being released back to the market.
     
    Since you own codingsoul.org, we believe that you might have an interest in securing codingsoul.net as well.
     
    If you are interested, please follow the link below to get more information and confirm your interest:
     
    domainlions.com/domains/offer/codingsoul.net
     
    All the additional information is available on our website, and feel free to reply back to our email and we will be more than happy to help you.
     
    Kind regards,
    David Pavel

     

    David Pavel
    Domain Lions, LLC
    T: +1 661 505 9573
    This is a one-time email.

    October 13, 2020

Comments are closed.