Windows container failed to start with error, “failed to create endpoint on network nat: HNS failed with error : Failed to create endpoint.”

后端 未结 4 938
你的背包
你的背包 2021-01-12 06:01

I have been trying Windows Containers on windows server 2016 TP5. Suddenly I started getting error while running a container with port maping option -p 80:80

4条回答
  •  臣服心动
    2021-01-12 06:41

    After searching around I stunbled upon this issue on github. This seemed to be a known issue with Windows containers on Windows server TP5.

    Then thanks to this forum, I found the solution You can check active static port mapping with below command

    C:\>powershell
    PS C:\>Get-NetNatStaticMapping
    
    
    StaticMappingID               : 3
    NatName                       : Hda6caca4-06ec-4251-8a98-1fe0b4c5af88
    Protocol                      : TCP
    RemoteExternalIPAddressPrefix : 0.0.0.0/0
    ExternalIPAddress             : 0.0.0.0
    ExternalPort                  : 80
    InternalIPAddress             : 172.31.181.4
    InternalPort                  : 80
    InternalRoutingDomainId       : {00000000-0000-0000-0000-000000000000}
    Active                        : True
    

    From above output it seemed that even though container was removed the static port mapping was not removed and was still active.

    But I removed it with below command.

    PS C:\> Get-NetNatStaticMapping | ? ExternalPort -eq 80 | Remove-NetNatStaticMapping
    

    Then simply rebooted the system and the error was gone.

提交回复
热议问题