​https://www.digitalocean.com/community/tutorials/how-to-configure-the-linux-firewall-for-docker-swarm-on-centos-7​

注意服务器需要防火墙开启端口,或者关闭防火墙

# 开放端口
firewall-cmd --add-port=2376/tcp --permanent
firewall-cmd --add-port=2377/tcp --permanent
firewall-cmd --add-port=7946/tcp --permanent
firewall-cmd --add-port=7946/udp --permanent
firewall-cmd --add-port=4789/udp --permanent
firewall-cmd --reload
systemctl restart docker
# 关闭防火墙
systemctl stop firewalld
systemctl disable firewalld

【1.10】服务器安装 Linux 防火墙设置_centos

image.png