部署服务时如何修复Docker错误"hnsCall failed in Win32: An adapter was not found"?
How to fix Docker error "hnsCall failed in Win32: An adapter was not found" when deploying service?
我正在尝试从我的主机 运行 一个四节点群,我的机器是管理器,三个 Hyper-V 虚拟机作为工作节点。
我正在尝试 运行 静态网页作为跨所有节点的服务,但在我的主机上不断收到 hnsCall failed in Win32: An adapter was not found
错误,并且从 VM 收到 No such image
(试图拉取服务图片来自私人注册表)。
部署堆栈或使用 service create
时会发生这种情况。
但是,我可以通过容器实例 运行 静态页面,它工作正常。
我按照 this guide 设置和创建了我的虚拟机,我怀疑这是我的问题所在。
我通过名为 thevswitch
的 HyperV 虚拟交换机管理器创建的虚拟交换机是外部的,并且设置在正确的适配器上。我使用主机的 IPv4 在 thevswitch
下为 --advertise-addr
标志初始化了一个群,并在使用驱动程序时成功地将 VM 作为工作节点加入到该 IP。 Docker 似乎没有看到我创建的虚拟交换机。
PS C:\Docker\swarm-test> docker version
Client: Docker Engine - Community
Version: 18.09.2
API version: 1.39
Go version: go1.10.8
Git commit: 6247962
Built: Sun Feb 10 04:12:31 2019
OS/Arch: windows/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.2
API version: 1.39 (minimum version 1.24)
Go version: go1.10.6
Git commit: 6247962
Built: Sun Feb 10 04:28:48 2019
OS/Arch: windows/amd64
Experimental: true
PS C:\Docker\swarm-test> docker network ls
NETWORK ID NAME DRIVER SCOPE
3f4030aafa56 Default Switch ics local
m1c2nzylf14x ingress overlay swarm
168954d1275d nat nat local
be3f092c32cb none null local
PS C:\Docker\swarm-test> docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
4xiljuldm32avsxwo8o513uv5 * ATLL000597 Ready Active Leader 18.09.2
w2ftfwt4oz00keswt6ztmq9ec vm1 Ready Active 18.09.6
82vpc65ezml87sxhhx9mlvszk vm2 Ready Active 18.09.6
lej0a3gabyi3qfta1f4le1f3s vm3 Ready Active 18.09.6
PS C:\Docker\swarm-test> docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
vm1 - hyperv Running tcp://10.195.12.68:2376 v18.09.6
vm2 - hyperv Running tcp://10.195.12.69:2376 v18.09.6
vm3 - hyperv Running tcp://10.195.12.75:2376 v18.09.6
主机 ipconfig:
PS C:\Docker\swarm-test> ipconfig
Windows IP Configuration
Ethernet adapter Ethernet 3:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter vEthernet (thevswitch):
Connection-specific DNS Suffix . : Int.CSDental.com
Link-local IPv6 Address . . . . . : fe80::e90f:a37:5f33:87de%29
IPv4 Address. . . . . . . . . . . : 10.195.12.87
Subnet Mask . . . . . . . . . . . : 255.255.252.0
Default Gateway . . . . . . . . . : 10.195.12.1
Wireless LAN adapter Wi-Fi:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Wireless LAN adapter Local Area Connection* 9:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Wireless LAN adapter Local Area Connection* 10:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter Ethernet 4:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter Bluetooth Network Connection:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter vEthernet (Default Switch) 2:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::5de7:19c9:a701:b06a%65
IPv4 Address. . . . . . . . . . . : 192.168.55.33
Subnet Mask . . . . . . . . . . . : 255.255.255.240
Default Gateway . . . . . . . . . :
Ethernet adapter vEthernet (nat) 2:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::f173:8:f6e1:123c%73
IPv4 Address. . . . . . . . . . . : 172.26.192.1
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . :
主机(管理员):
PS C:\Docker\swarm-test> docker inspect ATLL000597
[
{
"ID": "4xiljuldm32avsxwo8o513uv5",
"Version": {
"Index": 23501
},
"CreatedAt": "2019-05-29T16:41:17.1544224Z",
"UpdatedAt": "2019-05-29T17:35:40.2375377Z",
"Spec": {
"Labels": {},
"Role": "manager",
"Availability": "active"
},
"Description": {
"Hostname": "ATLL000597",
"Platform": {
"Architecture": "x86_64",
"OS": "windows"
},
"Resources": {
"NanoCPUs": 8000000000,
"MemoryBytes": 16971313152
},
"Engine": {
"EngineVersion": "18.09.2",
"Plugins": [
{
"Type": "Log",
"Name": "awslogs"
},
{
"Type": "Log",
"Name": "etwlogs"
},
{
"Type": "Log",
"Name": "fluentd"
},
{
"Type": "Log",
"Name": "gelf"
},
{
"Type": "Log",
"Name": "json-file"
},
{
"Type": "Log",
"Name": "local"
},
{
"Type": "Log",
"Name": "logentries"
},
{
"Type": "Log",
"Name": "splunk"
},
{
"Type": "Log",
"Name": "syslog"
},
{
"Type": "Network",
"Name": "ics"
},
{
"Type": "Network",
"Name": "l2bridge"
},
{
"Type": "Network",
"Name": "l2tunnel"
},
{
"Type": "Network",
"Name": "nat"
},
{
"Type": "Network",
"Name": "null"
},
{
"Type": "Network",
"Name": "overlay"
},
{
"Type": "Network",
"Name": "transparent"
},
{
"Type": "Volume",
"Name": "local"
}
]
},
"TLSInfo": {
"TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBazCCARCgAwIBAgIUew6Ov5cRAAXjR61XOWyX0l3evSYwCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTkwNTI5MTYzNjAwWhcNMzkwNTI0MTYz\nNjAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABHiJekXiApSizb5ctC5JJ0r1EBXvuN5iXMSe3VM/d9rvnjzFozY7VRgALhHb\nAP3wxnnsVPX29JC2ZUlv6//U0LSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBRUFwLEeWDMyZMC1QLrz1xhAyapuDAKBggqhkjO\nPQQDAgNJADBGAiEAqgyoSTtQxJ9RHnW2Zk7KsJthXSaoreN59vw+Ozp7XFACIQDB\n+tmtX3nGoeAf/np9j8oqvMNqApiPcxya8ToNSg/Otg==\n-----END CERTIFICATE-----\n",
"CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh",
"CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEeIl6ReIClKLNvly0LkknSvUQFe+43mJcxJ7dUz932u+ePMWjNjtVGAAuEdsA/fDGeexU9fb0kLZlSW/r/9TQtA=="
}
},
"Status": {
"State": "ready",
"Addr": "10.195.12.87"
},
"ManagerStatus": {
"Leader": true,
"Reachability": "reachable",
"Addr": "10.195.12.87:2377"
}
}
]
只是其中一个虚拟机:
PS C:\Docker\swarm-test> docker-machine inspect vm1
{
"ConfigVersion": 3,
"Driver": {
"IPAddress": "10.195.12.68",
"MachineName": "vm1",
"SSHUser": "docker",
"SSHPort": 22,
"SSHKeyPath": "C:\Users\19030430\.docker\machine\machines\vm1\id_rsa",
"StorePath": "C:\Users\19030430\.docker\machine",
"SwarmMaster": false,
"SwarmHost": "tcp://0.0.0.0:3376",
"SwarmDiscovery": "",
"Boot2DockerURL": "",
"VSwitch": "thevswitch",
"DiskSize": 20000,
"MemSize": 1024,
"CPU": 1,
"MacAddr": "",
"VLanID": 0,
"DisableDynamicMemory": false
},
"DriverName": "hyperv",
"HostOptions": {
"Driver": "",
"Memory": 0,
"Disk": 0,
"EngineOptions": {
"ArbitraryFlags": [],
"Dns": null,
"GraphDir": "",
"Env": [],
"Ipv6": false,
"InsecureRegistry": [],
"Labels": [],
"LogLevel": "",
"StorageDriver": "",
"SelinuxEnabled": false,
"TlsVerify": true,
"RegistryMirror": [],
"InstallURL": "https://get.docker.com"
},
"SwarmOptions": {
"IsSwarm": false,
"Address": "",
"Discovery": "",
"Agent": false,
"Master": false,
"Host": "tcp://0.0.0.0:3376",
"Image": "swarm:latest",
"Strategy": "spread",
"Heartbeat": 0,
"Overcommit": 0,
"ArbitraryFlags": [],
"ArbitraryJoinFlags": [],
"Env": null,
"IsExperimental": false
},
"AuthOptions": {
"CertDir": "C:\Users\19030430\.docker\machine\certs",
"CaCertPath": "C:\Users\19030430\.docker\machine\certs\ca.pem",
"CaPrivateKeyPath": "C:\Users\19030430\.docker\machine\certs\ca-key.pem",
"CaCertRemotePath": "",
"ServerCertPath": "C:\Users\19030430\.docker\machine\machines\vm1\server.pem",
"ServerKeyPath": "C:\Users\19030430\.docker\machine\machines\vm1\server-key.pem",
"ClientKeyPath": "C:\Users\19030430\.docker\machine\certs\key.pem",
"ServerCertRemotePath": "",
"ServerKeyRemotePath": "",
"ClientCertPath": "C:\Users\19030430\.docker\machine\certs\cert.pem",
"ServerCertSANs": [],
"StorePath": "C:\Users\19030430\.docker\machine\machines\vm1"
}
},
"Name": "vm1"
}
PS C:\Docker\swarm-test> get-hnsnetwork
ActivityId : F5EEF28D-7A66-410E-8F06-85417531C225
AdditionalParams :
CurrentEndpointCount : 0
Extensions : {@{Id=E7C3B2F0-F3C5-48DF-AF2B-10FED6D72E7A; IsEnabled=False; Name=Microsoft Windows Filtering Platform}, @{Id=E9B59CFA-2BE1-4B21-828F-B6FBDBDDC017; IsEnabled=False; Name=Microsoft Azure VFP Switch Extension},
@{Id=EA24CD6C-D17A-4348-9190-09F0D5BE83DD; IsEnabled=True; Name=Microsoft NDIS Capture}}
Flags : 3
GatewayMac : 00-15-5D-0C-C5-08
Health : @{AddressNotificationMissedCount=0; AddressNotificationSequenceNumber=5; InterfaceNotificationMissedCount=0; InterfaceNotificationSequenceNumber=0; LastErrorCode=0; LastUpdateTime=132036146558887527;
RouteNotificationMissedCount=0; RouteNotificationSequenceNumber=0}
ID : C08CB7B8-9B3C-408E-8E30-5E16A3AEB444
IPv6 : False
IsolateSwitch : True
LayeredOn : 77DEBE34-C5AF-43EF-86C1-92F7CF9CD8EF
MacPools : {@{EndMacAddress=00-15-5D-0C-CF-FF; StartMacAddress=00-15-5D-0C-C0-00}}
MaxConcurrentEndpoints : 0
Name : Default Switch
NatName : ICS85DBD8A9-EEA6-4691-9FE4-901A4445B714
Policies : {}
Resources : @{AdditionalParams=; AllocationOrder=2; Allocators=System.Object[]; Health=; ID=F5EEF28D-7A66-410E-8F06-85417531C225; PortOperationTime=0; State=1; SwitchOperationTime=0; VfpOperationTime=0;
parentId=D841CDEC-707C-421C-BC2C-155F3F378A40}
State : 1
Subnets : {@{AdditionalParams=; AddressPrefix=192.168.55.32/28; GatewayAddress=192.168.55.33; Health=; ID=F7DEEC46-10E5-448D-B890-D78D93E6D560; Policies=System.Object[]; State=0}}
SwitchGuid : C08CB7B8-9B3C-408E-8E30-5E16A3AEB444
TotalEndpoints : 0
Type : ICS
Version : 38654705666
ActivityId : 6589B251-E629-4942-847F-DEE47853D5B6
AdditionalParams :
CurrentEndpointCount : 0
Extensions : {@{Id=E7C3B2F0-F3C5-48DF-AF2B-10FED6D72E7A; IsEnabled=False; Name=Microsoft Windows Filtering Platform}, @{Id=E9B59CFA-2BE1-4B21-828F-B6FBDBDDC017; IsEnabled=False; Name=Microsoft Azure VFP Switch Extension},
@{Id=EA24CD6C-D17A-4348-9190-09F0D5BE83DD; IsEnabled=True; Name=Microsoft NDIS Capture}}
Flags : 0
Health : @{LastErrorCode=0; LastUpdateTime=132036158099689062}
ID : 07E7CCC7-187E-457B-A577-1EAFB16E9731
IPv6 : False
LayeredOn : 9108D862-FE98-4FE4-8004-2C210074F964
MacPools : {@{EndMacAddress=00-15-5D-B0-CF-FF; StartMacAddress=00-15-5D-B0-C0-00}}
MaxConcurrentEndpoints : 0
Name : thevswitch
Policies : {}
Resources : @{AdditionalParams=; AllocationOrder=0; Health=; ID=6589B251-E629-4942-847F-DEE47853D5B6; PortOperationTime=0; State=1; SwitchOperationTime=0; VfpOperationTime=0; parentId=CAEB6648-F50F-4C19-95D8-038C4E3B7346}
State : 1
TotalEndpoints : 0
Type : Transparent
Version : 38654705666
ActivityId : 7F5DFDB2-6E7E-497E-A33E-5BE5655DA57E
AdditionalParams :
CurrentEndpointCount : 0
Extensions : {@{Id=E7C3B2F0-F3C5-48DF-AF2B-10FED6D72E7A; IsEnabled=False; Name=Microsoft Windows Filtering Platform}, @{Id=E9B59CFA-2BE1-4B21-828F-B6FBDBDDC017; IsEnabled=False; Name=Microsoft Azure VFP Switch Extension},
@{Id=EA24CD6C-D17A-4348-9190-09F0D5BE83DD; IsEnabled=True; Name=Microsoft NDIS Capture}}
Flags : 0
Health : @{AddressNotificationMissedCount=0; AddressNotificationSequenceNumber=0; InterfaceNotificationMissedCount=0; InterfaceNotificationSequenceNumber=0; LastErrorCode=0; LastUpdateTime=132036143540255829;
RouteNotificationMissedCount=0; RouteNotificationSequenceNumber=0}
ID : B242C9F9-89C0-4867-B14A-8A175A5D0DDB
IPv6 : False
LayeredOn : 80208A97-455B-4273-B95A-1E73666C9C52
MacPools : {@{EndMacAddress=00-15-5D-D9-8F-FF; StartMacAddress=00-15-5D-D9-80-00}}
MaxConcurrentEndpoints : 0
Name : nat
NatName : ICSBC687A8B-1FC0-4F10-A614-68EA68A3E2EF
Policies : {}
Resources : @{AdditionalParams=; AllocationOrder=2; Allocators=System.Object[]; Health=; ID=7F5DFDB2-6E7E-497E-A33E-5BE5655DA57E; PortOperationTime=0; State=1; SwitchOperationTime=0; VfpOperationTime=0;
parentId=7507FF2E-F59E-4B2C-8194-DDA947C5B5AE}
State : 1
Subnets : {@{AdditionalParams=; AddressPrefix=172.26.192.0/20; GatewayAddress=172.26.192.1; Health=; ID=B735AB8E-A2F9-4134-84BC-598A492F976A; Policies=System.Object[]; State=0}}
TotalEndpoints : 0
Type : nat
Version : 38654705666
Docker文件:
version: "3"
services:
Hello:
image: registry.local:5000/wintest/swarm-test:2.0.0
ports:
-"8888:80"
deploy:
mode: global
PS C:\Docker\swarm-test> docker service ps test_Hello --no-trunc
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
27iw2nyi610g971bk0meeuf1h test_Hello.82vpc65ezml87sxhhx9mlvszk registry.local:5000/wintest/swarm-test:2.0.0 vm2 Ready Assigned less than a second ago
tw7ren3nakf0ukigjsqzrnkmf test_Hello.w2ftfwt4oz00keswt6ztmq9ec registry.local:5000/wintest/swarm-test:2.0.0 vm1 Ready Rejected less than a second ago "No such image: registry.local:5000/wintest/swarm-test:2.0.0"
xmdrc9102s4qjtstakrvh3msx test_Hello.4xiljuldm32avsxwo8o513uv5 registry.local:5000/wintest/swarm-test:2.0.0 ATLL000597 Ready Rejected 1 second ago "hnsCall failed in Win32: An adapter was not found. (0x803b0006)"
ezh203iv1ntj3w18wgqzdjceo test_Hello.lej0a3gabyi3qfta1f4le1f3s registry.local:5000/wintest/swarm-test:2.0.0 vm3 Running Rejected 4 seconds ago "No such image: registry.local:5000/wintest/swarm-test:2.0.0"
n3n4nfevoadawuqlusfbspg34 test_Hello.82vpc65ezml87sxhhx9mlvszk registry.local:5000/wintest/swarm-test:2.0.0 vm2 Shutdown Rejected 4 seconds ago "No such image: registry.local:5000/wintest/swarm-test:2.0.0"
t46s5etkwgumoa6jp22au3nq5 test_Hello.w2ftfwt4oz00keswt6ztmq9ec registry.local:5000/wintest/swarm-test:2.0.0 vm1 Shutdown Rejected 5 seconds ago "No such image: registry.local:5000/wintest/swarm-test:2.0.0"
rxwqbg2wndz4cdxw71k1d5ore test_Hello.4xiljuldm32avsxwo8o513uv5 registry.local:5000/wintest/swarm-test:2.0.0 ATLL000597 Shutdown Rejected 6 seconds ago "hnsCall failed in Win32: An adapter was not found. (0x803b0006)"
as92ats2qur5sr6e8lxflz71w test_Hello.lej0a3gabyi3qfta1f4le1f3s registry.local:5000/wintest/swarm-test:2.0.0 vm3 Shutdown Rejected 9 seconds ago "No such image: registry.local:5000/wintest/swarm-test:2.0.0"
引起我注意的是,检查 VM 似乎表明它们不是群的一部分,但它们是?
PS C:\Docker\swarm-test> docker-machine ssh vm1 "docker swarm init"
Error response from daemon: This node is already part of a swarm. Use "docker swarm leave" to leave this swarm and join another one.
exit status 1
此外,检查 Get-HNSNetwork
表明 thevswitch
是一个透明网络。根据我的理解,我创建网络的方式应该让它显示为覆盖(对于驱动程序)或外部。在之前完成这些任务的尝试中,我以完全相同的方式创建了另一个 vswitch,但那个显示为私有。我不明白遵循相同的步骤如何会产生两个不同且都不正确的结果。
这也是我的虚拟交换机管理器的屏幕截图:
V-Switch Manager
我已经阅读了 Docker 和 Windows 中关于网络的各种文档,特别是覆盖网络,我感到很迷茫。根据我的理解,这应该是可行的,而且我在网上发现的所有错误都指向相同的文档。我还没有看到任何让我认为这也无法完成的事情。
如有任何帮助,我们将不胜感激。
注意:第一次使用 Docker,尝试组合一个成功的 PoC。我知道我的 docker-compose.yml
不好看。我花在学习 docker 网络方面的时间比学习最佳实践的时间还多。
对于 运行 遇到类似问题的任何人:
问题实际上与这些错误消息所暗示的网络无关。
问题实际上最终是集群节点(但不是我的主机)都在使用 Linux 容器并试图拉取 Windows-only 图像。他们默默地抛出架构错误——我只是在尝试直接从节点中拉取图像时才发现这一点。部署到整个群时产生的错误具有很强的误导性。
我没有"fix"这个意思。我们最终围绕这个事实重构了我们的整个解决方案,并且这种情况不再适用。
我正在尝试从我的主机 运行 一个四节点群,我的机器是管理器,三个 Hyper-V 虚拟机作为工作节点。
我正在尝试 运行 静态网页作为跨所有节点的服务,但在我的主机上不断收到 hnsCall failed in Win32: An adapter was not found
错误,并且从 VM 收到 No such image
(试图拉取服务图片来自私人注册表)。
部署堆栈或使用 service create
时会发生这种情况。
但是,我可以通过容器实例 运行 静态页面,它工作正常。
我按照 this guide 设置和创建了我的虚拟机,我怀疑这是我的问题所在。
我通过名为 thevswitch
的 HyperV 虚拟交换机管理器创建的虚拟交换机是外部的,并且设置在正确的适配器上。我使用主机的 IPv4 在 thevswitch
下为 --advertise-addr
标志初始化了一个群,并在使用驱动程序时成功地将 VM 作为工作节点加入到该 IP。 Docker 似乎没有看到我创建的虚拟交换机。
PS C:\Docker\swarm-test> docker version
Client: Docker Engine - Community
Version: 18.09.2
API version: 1.39
Go version: go1.10.8
Git commit: 6247962
Built: Sun Feb 10 04:12:31 2019
OS/Arch: windows/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.2
API version: 1.39 (minimum version 1.24)
Go version: go1.10.6
Git commit: 6247962
Built: Sun Feb 10 04:28:48 2019
OS/Arch: windows/amd64
Experimental: true
PS C:\Docker\swarm-test> docker network ls
NETWORK ID NAME DRIVER SCOPE
3f4030aafa56 Default Switch ics local
m1c2nzylf14x ingress overlay swarm
168954d1275d nat nat local
be3f092c32cb none null local
PS C:\Docker\swarm-test> docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
4xiljuldm32avsxwo8o513uv5 * ATLL000597 Ready Active Leader 18.09.2
w2ftfwt4oz00keswt6ztmq9ec vm1 Ready Active 18.09.6
82vpc65ezml87sxhhx9mlvszk vm2 Ready Active 18.09.6
lej0a3gabyi3qfta1f4le1f3s vm3 Ready Active 18.09.6
PS C:\Docker\swarm-test> docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
vm1 - hyperv Running tcp://10.195.12.68:2376 v18.09.6
vm2 - hyperv Running tcp://10.195.12.69:2376 v18.09.6
vm3 - hyperv Running tcp://10.195.12.75:2376 v18.09.6
主机 ipconfig:
PS C:\Docker\swarm-test> ipconfig
Windows IP Configuration
Ethernet adapter Ethernet 3:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter vEthernet (thevswitch):
Connection-specific DNS Suffix . : Int.CSDental.com
Link-local IPv6 Address . . . . . : fe80::e90f:a37:5f33:87de%29
IPv4 Address. . . . . . . . . . . : 10.195.12.87
Subnet Mask . . . . . . . . . . . : 255.255.252.0
Default Gateway . . . . . . . . . : 10.195.12.1
Wireless LAN adapter Wi-Fi:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Wireless LAN adapter Local Area Connection* 9:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Wireless LAN adapter Local Area Connection* 10:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter Ethernet 4:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter Bluetooth Network Connection:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter vEthernet (Default Switch) 2:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::5de7:19c9:a701:b06a%65
IPv4 Address. . . . . . . . . . . : 192.168.55.33
Subnet Mask . . . . . . . . . . . : 255.255.255.240
Default Gateway . . . . . . . . . :
Ethernet adapter vEthernet (nat) 2:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::f173:8:f6e1:123c%73
IPv4 Address. . . . . . . . . . . : 172.26.192.1
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . :
主机(管理员):
PS C:\Docker\swarm-test> docker inspect ATLL000597
[
{
"ID": "4xiljuldm32avsxwo8o513uv5",
"Version": {
"Index": 23501
},
"CreatedAt": "2019-05-29T16:41:17.1544224Z",
"UpdatedAt": "2019-05-29T17:35:40.2375377Z",
"Spec": {
"Labels": {},
"Role": "manager",
"Availability": "active"
},
"Description": {
"Hostname": "ATLL000597",
"Platform": {
"Architecture": "x86_64",
"OS": "windows"
},
"Resources": {
"NanoCPUs": 8000000000,
"MemoryBytes": 16971313152
},
"Engine": {
"EngineVersion": "18.09.2",
"Plugins": [
{
"Type": "Log",
"Name": "awslogs"
},
{
"Type": "Log",
"Name": "etwlogs"
},
{
"Type": "Log",
"Name": "fluentd"
},
{
"Type": "Log",
"Name": "gelf"
},
{
"Type": "Log",
"Name": "json-file"
},
{
"Type": "Log",
"Name": "local"
},
{
"Type": "Log",
"Name": "logentries"
},
{
"Type": "Log",
"Name": "splunk"
},
{
"Type": "Log",
"Name": "syslog"
},
{
"Type": "Network",
"Name": "ics"
},
{
"Type": "Network",
"Name": "l2bridge"
},
{
"Type": "Network",
"Name": "l2tunnel"
},
{
"Type": "Network",
"Name": "nat"
},
{
"Type": "Network",
"Name": "null"
},
{
"Type": "Network",
"Name": "overlay"
},
{
"Type": "Network",
"Name": "transparent"
},
{
"Type": "Volume",
"Name": "local"
}
]
},
"TLSInfo": {
"TrustRoot": "-----BEGIN CERTIFICATE-----\nMIIBazCCARCgAwIBAgIUew6Ov5cRAAXjR61XOWyX0l3evSYwCgYIKoZIzj0EAwIw\nEzERMA8GA1UEAxMIc3dhcm0tY2EwHhcNMTkwNTI5MTYzNjAwWhcNMzkwNTI0MTYz\nNjAwWjATMREwDwYDVQQDEwhzd2FybS1jYTBZMBMGByqGSM49AgEGCCqGSM49AwEH\nA0IABHiJekXiApSizb5ctC5JJ0r1EBXvuN5iXMSe3VM/d9rvnjzFozY7VRgALhHb\nAP3wxnnsVPX29JC2ZUlv6//U0LSjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMB\nAf8EBTADAQH/MB0GA1UdDgQWBBRUFwLEeWDMyZMC1QLrz1xhAyapuDAKBggqhkjO\nPQQDAgNJADBGAiEAqgyoSTtQxJ9RHnW2Zk7KsJthXSaoreN59vw+Ozp7XFACIQDB\n+tmtX3nGoeAf/np9j8oqvMNqApiPcxya8ToNSg/Otg==\n-----END CERTIFICATE-----\n",
"CertIssuerSubject": "MBMxETAPBgNVBAMTCHN3YXJtLWNh",
"CertIssuerPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEeIl6ReIClKLNvly0LkknSvUQFe+43mJcxJ7dUz932u+ePMWjNjtVGAAuEdsA/fDGeexU9fb0kLZlSW/r/9TQtA=="
}
},
"Status": {
"State": "ready",
"Addr": "10.195.12.87"
},
"ManagerStatus": {
"Leader": true,
"Reachability": "reachable",
"Addr": "10.195.12.87:2377"
}
}
]
只是其中一个虚拟机:
PS C:\Docker\swarm-test> docker-machine inspect vm1
{
"ConfigVersion": 3,
"Driver": {
"IPAddress": "10.195.12.68",
"MachineName": "vm1",
"SSHUser": "docker",
"SSHPort": 22,
"SSHKeyPath": "C:\Users\19030430\.docker\machine\machines\vm1\id_rsa",
"StorePath": "C:\Users\19030430\.docker\machine",
"SwarmMaster": false,
"SwarmHost": "tcp://0.0.0.0:3376",
"SwarmDiscovery": "",
"Boot2DockerURL": "",
"VSwitch": "thevswitch",
"DiskSize": 20000,
"MemSize": 1024,
"CPU": 1,
"MacAddr": "",
"VLanID": 0,
"DisableDynamicMemory": false
},
"DriverName": "hyperv",
"HostOptions": {
"Driver": "",
"Memory": 0,
"Disk": 0,
"EngineOptions": {
"ArbitraryFlags": [],
"Dns": null,
"GraphDir": "",
"Env": [],
"Ipv6": false,
"InsecureRegistry": [],
"Labels": [],
"LogLevel": "",
"StorageDriver": "",
"SelinuxEnabled": false,
"TlsVerify": true,
"RegistryMirror": [],
"InstallURL": "https://get.docker.com"
},
"SwarmOptions": {
"IsSwarm": false,
"Address": "",
"Discovery": "",
"Agent": false,
"Master": false,
"Host": "tcp://0.0.0.0:3376",
"Image": "swarm:latest",
"Strategy": "spread",
"Heartbeat": 0,
"Overcommit": 0,
"ArbitraryFlags": [],
"ArbitraryJoinFlags": [],
"Env": null,
"IsExperimental": false
},
"AuthOptions": {
"CertDir": "C:\Users\19030430\.docker\machine\certs",
"CaCertPath": "C:\Users\19030430\.docker\machine\certs\ca.pem",
"CaPrivateKeyPath": "C:\Users\19030430\.docker\machine\certs\ca-key.pem",
"CaCertRemotePath": "",
"ServerCertPath": "C:\Users\19030430\.docker\machine\machines\vm1\server.pem",
"ServerKeyPath": "C:\Users\19030430\.docker\machine\machines\vm1\server-key.pem",
"ClientKeyPath": "C:\Users\19030430\.docker\machine\certs\key.pem",
"ServerCertRemotePath": "",
"ServerKeyRemotePath": "",
"ClientCertPath": "C:\Users\19030430\.docker\machine\certs\cert.pem",
"ServerCertSANs": [],
"StorePath": "C:\Users\19030430\.docker\machine\machines\vm1"
}
},
"Name": "vm1"
}
PS C:\Docker\swarm-test> get-hnsnetwork
ActivityId : F5EEF28D-7A66-410E-8F06-85417531C225
AdditionalParams :
CurrentEndpointCount : 0
Extensions : {@{Id=E7C3B2F0-F3C5-48DF-AF2B-10FED6D72E7A; IsEnabled=False; Name=Microsoft Windows Filtering Platform}, @{Id=E9B59CFA-2BE1-4B21-828F-B6FBDBDDC017; IsEnabled=False; Name=Microsoft Azure VFP Switch Extension},
@{Id=EA24CD6C-D17A-4348-9190-09F0D5BE83DD; IsEnabled=True; Name=Microsoft NDIS Capture}}
Flags : 3
GatewayMac : 00-15-5D-0C-C5-08
Health : @{AddressNotificationMissedCount=0; AddressNotificationSequenceNumber=5; InterfaceNotificationMissedCount=0; InterfaceNotificationSequenceNumber=0; LastErrorCode=0; LastUpdateTime=132036146558887527;
RouteNotificationMissedCount=0; RouteNotificationSequenceNumber=0}
ID : C08CB7B8-9B3C-408E-8E30-5E16A3AEB444
IPv6 : False
IsolateSwitch : True
LayeredOn : 77DEBE34-C5AF-43EF-86C1-92F7CF9CD8EF
MacPools : {@{EndMacAddress=00-15-5D-0C-CF-FF; StartMacAddress=00-15-5D-0C-C0-00}}
MaxConcurrentEndpoints : 0
Name : Default Switch
NatName : ICS85DBD8A9-EEA6-4691-9FE4-901A4445B714
Policies : {}
Resources : @{AdditionalParams=; AllocationOrder=2; Allocators=System.Object[]; Health=; ID=F5EEF28D-7A66-410E-8F06-85417531C225; PortOperationTime=0; State=1; SwitchOperationTime=0; VfpOperationTime=0;
parentId=D841CDEC-707C-421C-BC2C-155F3F378A40}
State : 1
Subnets : {@{AdditionalParams=; AddressPrefix=192.168.55.32/28; GatewayAddress=192.168.55.33; Health=; ID=F7DEEC46-10E5-448D-B890-D78D93E6D560; Policies=System.Object[]; State=0}}
SwitchGuid : C08CB7B8-9B3C-408E-8E30-5E16A3AEB444
TotalEndpoints : 0
Type : ICS
Version : 38654705666
ActivityId : 6589B251-E629-4942-847F-DEE47853D5B6
AdditionalParams :
CurrentEndpointCount : 0
Extensions : {@{Id=E7C3B2F0-F3C5-48DF-AF2B-10FED6D72E7A; IsEnabled=False; Name=Microsoft Windows Filtering Platform}, @{Id=E9B59CFA-2BE1-4B21-828F-B6FBDBDDC017; IsEnabled=False; Name=Microsoft Azure VFP Switch Extension},
@{Id=EA24CD6C-D17A-4348-9190-09F0D5BE83DD; IsEnabled=True; Name=Microsoft NDIS Capture}}
Flags : 0
Health : @{LastErrorCode=0; LastUpdateTime=132036158099689062}
ID : 07E7CCC7-187E-457B-A577-1EAFB16E9731
IPv6 : False
LayeredOn : 9108D862-FE98-4FE4-8004-2C210074F964
MacPools : {@{EndMacAddress=00-15-5D-B0-CF-FF; StartMacAddress=00-15-5D-B0-C0-00}}
MaxConcurrentEndpoints : 0
Name : thevswitch
Policies : {}
Resources : @{AdditionalParams=; AllocationOrder=0; Health=; ID=6589B251-E629-4942-847F-DEE47853D5B6; PortOperationTime=0; State=1; SwitchOperationTime=0; VfpOperationTime=0; parentId=CAEB6648-F50F-4C19-95D8-038C4E3B7346}
State : 1
TotalEndpoints : 0
Type : Transparent
Version : 38654705666
ActivityId : 7F5DFDB2-6E7E-497E-A33E-5BE5655DA57E
AdditionalParams :
CurrentEndpointCount : 0
Extensions : {@{Id=E7C3B2F0-F3C5-48DF-AF2B-10FED6D72E7A; IsEnabled=False; Name=Microsoft Windows Filtering Platform}, @{Id=E9B59CFA-2BE1-4B21-828F-B6FBDBDDC017; IsEnabled=False; Name=Microsoft Azure VFP Switch Extension},
@{Id=EA24CD6C-D17A-4348-9190-09F0D5BE83DD; IsEnabled=True; Name=Microsoft NDIS Capture}}
Flags : 0
Health : @{AddressNotificationMissedCount=0; AddressNotificationSequenceNumber=0; InterfaceNotificationMissedCount=0; InterfaceNotificationSequenceNumber=0; LastErrorCode=0; LastUpdateTime=132036143540255829;
RouteNotificationMissedCount=0; RouteNotificationSequenceNumber=0}
ID : B242C9F9-89C0-4867-B14A-8A175A5D0DDB
IPv6 : False
LayeredOn : 80208A97-455B-4273-B95A-1E73666C9C52
MacPools : {@{EndMacAddress=00-15-5D-D9-8F-FF; StartMacAddress=00-15-5D-D9-80-00}}
MaxConcurrentEndpoints : 0
Name : nat
NatName : ICSBC687A8B-1FC0-4F10-A614-68EA68A3E2EF
Policies : {}
Resources : @{AdditionalParams=; AllocationOrder=2; Allocators=System.Object[]; Health=; ID=7F5DFDB2-6E7E-497E-A33E-5BE5655DA57E; PortOperationTime=0; State=1; SwitchOperationTime=0; VfpOperationTime=0;
parentId=7507FF2E-F59E-4B2C-8194-DDA947C5B5AE}
State : 1
Subnets : {@{AdditionalParams=; AddressPrefix=172.26.192.0/20; GatewayAddress=172.26.192.1; Health=; ID=B735AB8E-A2F9-4134-84BC-598A492F976A; Policies=System.Object[]; State=0}}
TotalEndpoints : 0
Type : nat
Version : 38654705666
Docker文件:
version: "3"
services:
Hello:
image: registry.local:5000/wintest/swarm-test:2.0.0
ports:
-"8888:80"
deploy:
mode: global
PS C:\Docker\swarm-test> docker service ps test_Hello --no-trunc
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
27iw2nyi610g971bk0meeuf1h test_Hello.82vpc65ezml87sxhhx9mlvszk registry.local:5000/wintest/swarm-test:2.0.0 vm2 Ready Assigned less than a second ago
tw7ren3nakf0ukigjsqzrnkmf test_Hello.w2ftfwt4oz00keswt6ztmq9ec registry.local:5000/wintest/swarm-test:2.0.0 vm1 Ready Rejected less than a second ago "No such image: registry.local:5000/wintest/swarm-test:2.0.0"
xmdrc9102s4qjtstakrvh3msx test_Hello.4xiljuldm32avsxwo8o513uv5 registry.local:5000/wintest/swarm-test:2.0.0 ATLL000597 Ready Rejected 1 second ago "hnsCall failed in Win32: An adapter was not found. (0x803b0006)"
ezh203iv1ntj3w18wgqzdjceo test_Hello.lej0a3gabyi3qfta1f4le1f3s registry.local:5000/wintest/swarm-test:2.0.0 vm3 Running Rejected 4 seconds ago "No such image: registry.local:5000/wintest/swarm-test:2.0.0"
n3n4nfevoadawuqlusfbspg34 test_Hello.82vpc65ezml87sxhhx9mlvszk registry.local:5000/wintest/swarm-test:2.0.0 vm2 Shutdown Rejected 4 seconds ago "No such image: registry.local:5000/wintest/swarm-test:2.0.0"
t46s5etkwgumoa6jp22au3nq5 test_Hello.w2ftfwt4oz00keswt6ztmq9ec registry.local:5000/wintest/swarm-test:2.0.0 vm1 Shutdown Rejected 5 seconds ago "No such image: registry.local:5000/wintest/swarm-test:2.0.0"
rxwqbg2wndz4cdxw71k1d5ore test_Hello.4xiljuldm32avsxwo8o513uv5 registry.local:5000/wintest/swarm-test:2.0.0 ATLL000597 Shutdown Rejected 6 seconds ago "hnsCall failed in Win32: An adapter was not found. (0x803b0006)"
as92ats2qur5sr6e8lxflz71w test_Hello.lej0a3gabyi3qfta1f4le1f3s registry.local:5000/wintest/swarm-test:2.0.0 vm3 Shutdown Rejected 9 seconds ago "No such image: registry.local:5000/wintest/swarm-test:2.0.0"
引起我注意的是,检查 VM 似乎表明它们不是群的一部分,但它们是?
PS C:\Docker\swarm-test> docker-machine ssh vm1 "docker swarm init"
Error response from daemon: This node is already part of a swarm. Use "docker swarm leave" to leave this swarm and join another one.
exit status 1
此外,检查 Get-HNSNetwork
表明 thevswitch
是一个透明网络。根据我的理解,我创建网络的方式应该让它显示为覆盖(对于驱动程序)或外部。在之前完成这些任务的尝试中,我以完全相同的方式创建了另一个 vswitch,但那个显示为私有。我不明白遵循相同的步骤如何会产生两个不同且都不正确的结果。
这也是我的虚拟交换机管理器的屏幕截图: V-Switch Manager
我已经阅读了 Docker 和 Windows 中关于网络的各种文档,特别是覆盖网络,我感到很迷茫。根据我的理解,这应该是可行的,而且我在网上发现的所有错误都指向相同的文档。我还没有看到任何让我认为这也无法完成的事情。
如有任何帮助,我们将不胜感激。
注意:第一次使用 Docker,尝试组合一个成功的 PoC。我知道我的 docker-compose.yml
不好看。我花在学习 docker 网络方面的时间比学习最佳实践的时间还多。
对于 运行 遇到类似问题的任何人:
问题实际上与这些错误消息所暗示的网络无关。 问题实际上最终是集群节点(但不是我的主机)都在使用 Linux 容器并试图拉取 Windows-only 图像。他们默默地抛出架构错误——我只是在尝试直接从节点中拉取图像时才发现这一点。部署到整个群时产生的错误具有很强的误导性。
我没有"fix"这个意思。我们最终围绕这个事实重构了我们的整个解决方案,并且这种情况不再适用。