为 docker 群(集群)打开的端口

Ports to open for docker swarm(cluster)

在中部地区创建了 6 个 EC2 实例。

以下安全组(仅)适用于每个 EC2 实例:

在 docker 群

中的 6 个节点中,3 个管理节点和 3 个工作节点

docker 版本 19.03.1

EC2 实例 (mgr1) 使用命令成功包含在 swarm(cluster) 中:

 docker swarm init --advertise-addr 172.31.4.156:2377 --listen-addr 172.31.4.156:2377

mgr2 上,在 运行 以下命令之后:

ubuntu@mgr2:~$ docker swarm join --token SWMTKN-1-2emfdddddddddddddddddue2y75runbithrtcadjakh8ttgt 172.31.4.156:2377 --advertise-addr 172.31.27.84:2377 --listen-addr 172.31.27.84:2377

给出以下错误:

Error response from daemon: Timeout was reached before node 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.
ubuntu@mgr2:~$ 

mgr2 上检查集群状态时,输出如下:

ubuntu@mgr2:~$ docker node ls

给予

Error response from daemon: This node is not a swarm manager.Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.

1) 所有 6 个 EC2 节点应该打开哪些端口号?入站和出站

2) 通信是基于TCP的吗?用于 docker 群的工作...

需要为 docker swarm 打开的 TCP 和 UDP 端口已记录 here