- 官方说明
https://docs.docker.com/network/overlay/
You need the following ports open to traffic to and from each Docker host participating on an overlay network:● TCP port 2377 for cluster management communications● TCP and UDP port 7946 for communication among nodes● UDP port 4789 for overlay network traffic
全命令行加端口
firewall-cmd --add-port=2377/tcp --permanentfirewall-cmd --add-port=7946/tcp --permanentfirewall-cmd --add-port 7946/udp --permanentfirewall-cmd --add-port=4789/udp --permanentfirewall-cmd --reloadsystemctl restart docker
新增配置文件加端口
cat << EOF >/etc/firewalld/services/docker_swarm.xml <?xml version="1.0" encoding="utf-8"?> <service> <description>this is docker swarm port</description> <port protocol="udp" port="4789"/> <port protocol="udp" port="7946"/> <port protocol="tcp" port="2377"/> <port protocol="tcp" port="7946"/> </service> EOFfirewall-cmd --add-service=docker_swarm --permanent firewall-cmd --reload systemctl restart docker
