docker swarm-mode
root@node1:~# docker version
Client:
Version: 1.12.3
API version: 1.24
Go version: go1.6.3
Git commit: 6b644ec
Built: Wed Oct 26 21:39:03 2016
OS/Arch: linux/amd64
Server:
Version: 1.12.3
API version: 1.24
Go version: go1.6.3
Git commit: 6b644ec
Built: Wed Oct 26 21:39:03 2016
OS/Arch: linux/amd64
--- master ---
root@node1:~# docker swarm init --advertise-addr 172.18.0.78
Swarm initialized: current node (32qkctttt899iri46ljh4cobs) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-0001dwbbgz9q4m1qelrmvm9w6yf6ldt6df6yl547s73hy5jd5n-50gpz8hqcs95tqqaumfmxcfo8 \
172.18.0.78:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
--- worker ---
root@node1:~# docker swarm join \
--token SWMTKN-1-0001dwbbgz9q4m1qelrmvm9w6yf6ldt6df6yl547s73hy5jd5n-50gpz8hqcs95tqqaumfmxcfo8 \
172.18.0.78:2377
--- command ---
(退出 swarm)
docker swarm leave --force
查看节点列表
docker node ls
节点升级为manager
docker node promote
节点降级worker
docker node demote
查看节点详细信息
docker node inspect
删除一个节点
docker node rm
可以查看节点上运行的任务task
docker node tasks
可以更新一个节点
docker node update