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

时间:2017-09-08 12:50:36

标签: docker amazon-ec2 docker-swarm

我是AWS EC2的新手,

目标:在EC2上创建3个Ubuntu机器实例,并在第一个实例上初始化Swarm,并将其他2个实例作为worker添加到Swarm中。

错误:Swarm初始化工作正常,但向swarm添加worker会抛出错误

~$ 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: after swarm init, workers unable to join swarm)上的相关问题,但这些解决方案在我的情况下不起作用

如何启用其他2个实例加入群组

1 个答案:

答案 0 :(得分:7)

这看起来与您的安全设置有关。确保所有必需的端口都已打开

On Managers:

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以确保其中任何内容都无法阻止访问