Windows 容器无法启动,出现错误,“无法在网络 nat 上创建端点:HNS 失败,错误:无法创建端点." [英] Windows container failed to start with error, "failed to create endpoint on network nat: HNS failed with error : Failed to create endpoint."

查看:55
本文介绍了Windows 容器无法启动,出现错误,“无法在网络 nat 上创建端点:HNS 失败,错误:无法创建端点."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在 Windows Server 2016 TP5 上尝试 Windows Containers.突然,我在运行带有端口映射选项 -p 80:80

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

c:\>docker run -it -p 80:80 microsoft/iis cmd
docker: Error response from daemon: failed to create endpoint sharp_brahmagupta on network nat: HNS failed with error : Failed to create endpoint.

我确保没有其他容器正在运行,并且主机上的端口 80 没有被任何其他服务使用.

I made sure that no other container is running and port 80 on host machine is not being used by any other service.

有人遇到过同样的问题吗?

Did anyone face same issue?

推荐答案

四处搜索后,我偶然发现了 github上的这个问题.这似乎是 Windows 服务器 TP5 上的 Windows 容器的一个已知问题.

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

那么感谢 this 论坛,我找到了解决方案您可以使用以下命令检查活动的静态端口映射

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.

这篇关于Windows 容器无法启动,出现错误,“无法在网络 nat 上创建端点:HNS 失败,错误:无法创建端点."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆