Docker Swarm全局服务副本只能在leader节点上运行。 容器错误:HNS失败,出现错误:{Object Exists}

当我尝试使用全局模式部署服务时,只有Leader节点上的副本运行,工作节点上的副本不运行。 我有两个在AWS上运行的Windows Server 2016实例(1个领导者和1个工人节点)。 我正在使用标准的Microsoft / iis图像。 两个节点的状态都是“就绪”

PS C:\Users\Administrator> docker version Client: Version: 17.06.2-ee-6 API version: 1.30 Go version: go1.8.3 Git commit: e75fdb8 Built: Mon Nov 27 22:46:09 2017 OS/Arch: windows/amd64 Server: Version: 17.06.2-ee-6 API version: 1.30 (minimum version 1.24) Go version: go1.8.3 Git commit: e75fdb8 Built: Mon Nov 27 22:55:16 2017 OS/Arch: windows/amd64 Experimental: false 

这是我运行的部署服务的命令:

docker service create --name web --mode global --publish 8080:80 microsoft/iis

在全局模式下,应该在每个节点上运行一个副本。 然而,只有两个副本中的一个正在运行(如下所示)。 副本运行在“Leader”节点上。 工人节点上的副本没有被创build。

 PS C:\Users\Administrator> docker service ls ID NAME MODE REPLICAS IMAGE PORTS we1v56oqqg85 web global 1/2 microsoft/iis:latest *:8080->80/tcp 

我检查了其中一个在worker节点上运行失败的容器,并且给出的错误是: Err“:”HNS失败,出现错误:{Object Exists}试图创build一个对象并且对象名已经存在。

 PS C:\Users\Administrator> docker inspect udx0u2r79qak [ { "ID": "udx0u2r79qakjqj47q54h77im", "Version": { "Index": 3097 }, "CreatedAt": "2017-12-20T01:23:16.8231351Z", "UpdatedAt": "2017-12-20T01:23:22.0121065Z", "Labels": {}, "Spec": { "ContainerSpec": { "Image": "microsoft/iis:latest@sha256:fdabed2b25528610300f61ec4fc62c93858080e943c8170b2eb3b78f3cb34d6f", "DNSConfig": {} }, "Resources": { "Limits": {}, "Reservations": {} }, "Placement": { "Platforms": [ { "Architecture": "amd64", "OS": "windows" }, { "Architecture": "amd64", "OS": "windows" } ] }, "ForceUpdate": 0 }, "ServiceID": "we1v56oqqg85jc97ro3h385a5", "NodeID": "v9v4k3v3rc1vbfugrj62jtd56", "Status": { "Timestamp": "2017-12-20T01:23:17.0172859Z", "State": "rejected", "Message": "preparing", "Err": "HNS failed with error : {Object Exists} An attempt was made to create an object and the object name already existed. ", "ContainerStatus": {}, "PortStatus": {} }, "DesiredState": "shutdown", "NetworksAttachments": [ { "Network": { "ID": "ob7ysngbmgnk57r68tpk3miun", "Version": { "Index": 2998 }, "CreatedAt": "2017-12-19T21:48:23.5930028Z", "UpdatedAt": "2017-12-20T01:16:01.771829Z", "Spec": { "Name": "ingress", "Labels": {}, "DriverConfiguration": {}, "Ingress": true, "IPAMOptions": { "Driver": {}, "Configs": [ { "Subnet": "10.255.0.0/16", "Gateway": "10.255.0.1" } ] }, "Scope": "swarm" }, "DriverState": { "Name": "overlay", "Options": { "com.docker.network.driver.overlay.vxlanid_list": "4096" } }, "IPAMOptions": { "Driver": { "Name": "default" }, "Configs": [ { "Subnet": "10.255.0.0/16", "Gateway": "10.255.0.1" } ] } }, "Addresses": [ "10.255.0.19/16" ] } ] } ] 

在我的研究过程中,我遇到了这个问题: https : //github.com/MicrosoftDocs/Virtualization-Documentation/issues/529其中谈到了错误,但没有任何build议帮助。

我尝试重置HNS C:\ ProgramData \ Microsoft \ Windows \ HNS \ HNS.data,然后重新启动它。 我也尝试运行这个页面上build议的脚本: https : //github.com/MicrosoftDocs/Virtualization-Documentation/tree/live/windows-server-container-tools/CleanupContainerHostNetworking#force-networking-cleanup

AWS实例不支持Hyper-V,这可能是问题的一部分,因为这限制了networking选项,但这仅仅是一个微弱的怀疑。

我将如何去解决这个主机networking服务(HNS)错误?