我正在尝试从我的主机运行一个四节点群集,我的计算机是管理器,并将三个Hyper-V VM作为工作节点。
我试图在所有节点上将静态网页作为服务运行,但是在主机上不断收到hnsCall failed in Win32: An adapter was not found
错误,并且从VM收到No such image
(试图从私有注册表中提取服务映像) )。
在部署堆栈或使用service create
时会发生这种情况。
但是,我可以通过容器实例运行静态页面,并且效果很好。
我遵循this guide来设置和创建我的VM,我怀疑这是我的问题所在。
我通过HyperV虚拟交换机管理器创建的名为thevswitch
的虚拟交换机既在外部,又在正确的适配器上设置。我在thevswitch
标志下使用主机的IPv4在--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"
}
}
]
只是其中一个VM:
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
Dockerfile:
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,但该vswitch显示为私有。我不明白,按照相同的步骤进行操作会如何产生两种不同且均不正确的结果。
这也是我的虚拟交换机管理器的屏幕截图: V-Switch Manager
我已经阅读了Docker和Windows上有关网络(尤其是覆盖网络)的各种文档,我感到非常迷茫。据我了解,这应该可以正常工作,而且我在网上发现的所有错误都指向同一文档。我没有看到任何让我觉得也无法完成的事情。
任何帮助将不胜感激。
注意:第一次使用Docker,试图将一个成功的PoC组合在一起。我知道我的docker-compose.yml
看起来不太漂亮。与学习最佳实践相比,我花了更多时间来学习与Docker的联网。
答案 0 :(得分:0)
对于遇到类似问题的任何人:
该问题实际上与网络无关,如暗示的这些错误消息。 问题实际上最终是,群集节点(而不是我的主机)都使用Linux容器并试图提取仅Windows的映像。他们默默地抛出体系结构错误-只有在尝试直接从节点提取映像时,我才发现这一点。部署到整个集群时所产生的错误具有高度误导性。
我没有说每个“解决”这个问题。我们最终围绕这一事实重组了整个解决方案,这种情况不再适用。