docker swarm创建swarm集群
三台linux主机
manager:192.168.100.151
work1:192.168.100.156
work2:192.168.100.157
manager
docker swarm init --advertise-addr=192.168.100.151
会产生一个join-token:
To add a manager to this swarm, run the following command:
docker swarm join --token SWMTKN-1-17o3nuwv15qcg7f3omsxslb110nr54ndz4otwpjub6g9z18mdk-12aaimdkubrbm7j49pyd8xwo8 192.168.100.151:2377
work1
docker swarm join --token SWMTKN-1-17o3nuwv15qcg7f3omsxslb110nr54ndz4otwpjub6g9z18mdk-12aaimdkubrbm7j49pyd8xwo8 192.168.100.151:2377
work2
docker swarm join --token SWMTKN-1-17o3nuwv15qcg7f3omsxslb110nr54ndz4otwpjub6g9z18mdk-12aaimdkubrbm7j49pyd8xwo8 192.168.100.151:2377
1.可能会产生这样的一个错误:certificate has expired or is not yet valid
时间不同步造成的,解决参照:https://www.cnblogs.com/soymilk2019/p/11597146.html
2.Error response from daemon: --cluster-store and --cluster-advertise daemon configurations are incompatible with swarm mode
还有如果之前主机装过etcd这样的同步软件需要卸载,否者会跟docker swarm本身提供同步功能冲突