![Docker Swarm Mes 无法在混合 Win7 / Linux 集群上运行](https://linux22.com/image/722869/Docker%20Swarm%20Mes%20%E6%97%A0%E6%B3%95%E5%9C%A8%E6%B7%B7%E5%90%88%20Win7%20%2F%20Linux%20%E9%9B%86%E7%BE%A4%E4%B8%8A%E8%BF%90%E8%A1%8C.png)
我有一个混合 Docker Swarm 集群,其中运行着 Linux 机器和 Win7 机器通过 NAT 的 VirtualBox(不允许桥接选项)。
Win7 Win7
| |
(port forwarding on 7946tcp/udp, 2377tcp, 4789udp)
| |
+----+----+ +----+----+ +-------+ +-------+
| VirtBox | | VirtBox | | linux | | linux |
+----+----+ +----+----+ +---+---+ +---+---+
| | | |
+----+---+ +----+---+ +----+---+ +----+---+
| docker | | docker | | docker | | docker |
+----+---+ +----+---+ +----+---+ +----+---+
| | | |
+----+------------+-----------+------------+---+
| docker swarm |
+----------------------------------------------+
Docker swarm 已初始化成功(如下图所示):
docker@frankie:~$ docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
ban0an8sg * Win1 Ready Active Reachable 18.05.0-ce
asdlkj328 Win2 Ready Active Leader 18.05.0-ce
9w05zyye6 Linux1 Ready Active Reachable 18.03.1-ce
slkhj2387 Linux2 Ready Active Reachable 18.03.1-ce
我可以毫无问题地向集群启动服务:
docker@frankie:~$ docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
9w05zyye6 my-web replicated 1/1 nginx:latest *:8083->80/tcp
很遗憾swarm mesh 只在 Linux 机器之间工作。我可以直接在运行该服务的机器上访问它(即使服务在 Windows 上运行)但网络网格仅在 Linux 之间有效。
accessible on ► | win1 | win2 | lin1 | lin2
running on ▼ +------+------+------+------
win1 | x | | |
win2 | | x | |
linux1 | | | x | x
linux2 | | | x | x
知道问题可能出在哪里吗?
编辑(为澄清起见,添加了端口添加命令):
VBoxManage.exe controlvm "win1" natpf1 "docker-swarm-cluster-management,tcp,0.0.0.0,2377,,2377"
VBoxManage.exe controlvm "win1" natpf1 "docker-swarm-cluster-comm-tcp,tcp,0.0.0.0,7946,,7946"
VBoxManage.exe controlvm "win1" natpf1 "docker-swarm-cluster-comm-udp,udp,0.0.0.0,7946,,7946"
VBoxManage.exe controlvm "win1" natpf1 "docker-swarm-cluster-traffic,udp,0.0.0.0,4789,,4789"