docker安装swarm
操作的ip地址:192.168.0.200
1、下载swarm
下载swarm插件
1 | docker pull swarm |
2、安装swarm
1 | docker swarm init --advertise-addr 192.168.0.200:2377 --listen-addr 192.168.0.200:2377 |
输出
1 | [root@localhost ~]# docker swarm init --advertise-addr 192.168.0.200:2377 --listen-addr 192.168.0.200:2377 |
3、将本机加入节点
1 | docker swarm join-token manager |
输出
1 | [root@localhost ~]# docker swarm join-token manager |
用yml文件启动nginx
1、下载nginx
1 | docker pull nginx:1.19.5 |
2、编写启动文件nginx.yml
1 | [root@localhost nginx]# cat nginx.yml |
3.启动nginx
1 | docker stack deploy --with-registry-auth -c nginx.yml rb |
4.查看启动情况
1 | docker stack services rb |
输出
1 | [root@localhost nginx]# docker stack services rb |