全部主机:
打开路由转发,否则待会生成镜像会报错!
echo "net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1" >> /etc/sysctl.conf
sysctl -p
master:
yum -y install wget telnet lsof vim
systemctl restart firewalld
yum install -y yum-utils device-mapper-persistent-data lvm2
firewall-cmd --zone=public --add-port=2377/tcp --permanent
firewall-cmd --zone=public --add-port=7946/tcp --permanent
firewall-cmd --zone=public --add-port=7946/udp --permanent
firewall-cmd --zone=public --add-port=4789/tcp --permanent
firewall-cmd --zone=public --add-port=4789/udp --permanent
firewall-cmd --reload
systemctl restart docker
setenforce 0
docker swarm init --advertise-addr 192.168.1.11
#执行完之后,复制docker swarm join --token xxx 192.168.1.11:2377
docker swarm join-token worker
docker info
docker node ls
node1:
docker swarm join --token xxx 192.168.1.11:2377
#敲上面执行docker swarm init --advertise-addr 192.168.1.11后复制的那条命令
node2:
docker swarm join --token xxx 192.168.1.11:2377
#敲上面执行docker swarm init --advertise-addr 192.168.1.11后复制的那条命令
master:
docker info
#查看Swarm群集的信息
docker node ls
#查看Swarm群集中全部Node的详细状态信息
docker node inspect self
#查看某一个Node的状态信息