AWS EC2上的工作人员无法连接到Swarm

我是AWS EC2的新手,

目标:在EC2上创build3个Ubuntu机器实例,并初始化Swarm,并将其他2个实例作为工作者添加到Swarm中。

错误:群体初始化工作正常,但向群体添加工作人员会引发错误

~$ docker swarm join --token SWMTKN-1-4yquvx0xihdhcv0m1vmxmbq4q45hoanm9ig00pue7opx3dhc1s-2ybrjxx97mpjyo351sx8jyisp 172.31.31.41:2377 Error response from daemon: Timeout was reached before node was joined. The attempt to join the swarm will continue in the background. Use the "docker info" command to see the current swarm status of your node. ~$ docker info ***** Swarm: error NodeID: Error: rpc error: code = DeadlineExceeded desc = context deadline exceeded Is Manager: false ****** 

我已经看到了有关stackoverflow的问题( Docker 1.12.1:在swarm初始化后,工人无法joinswarm ),但是这些解决scheme在我的情况下不起作用

我如何启用我的其他2个实例join群

这看起来像您的安全设置的问题。 确保所有需要的端口都打开

经理人:

 Custom TCP Rule TCP 2377 swarm + remote mgmt Custom TCP Rule TCP 7946 swarm Custom UDP Rule UDP 7946 swarm Custom UDP Rule UDP 4789 swarm 

在工人

 Custom TCP Rule TCP 7946 swarm Custom UDP Rule UDP 7946 swarm Custom UDP Rule UDP 4789 swarm 

请参阅下面的更多细节

https://gist.github.com/BretFisher/7233b7ecf14bc49eb47715bbeb2a2769

同时检查ufw statusiptables -Ssestatus以确保其中的任何一个都不会阻止访问