-
打开manager1服务器 shell
ssh to swarm-master
docker-machine ssh swarm-master # 如果使用docker-machine
-
初始化 swarm
docker swarm init
docker swarm init --advertise-addr <MANAGER-IP>
$ docker swarm init --advertise-addr 192.168.10.211 Swarm initialized: current node (j1dxu07y1b7z0x5t0xbznbqra) is now a manager. To add a worker to this swarm, run the following command: docker swarm join --token SWMTKN-1-1kmmb9epxw85f29ucb5gfd9638u0yzdrbmsl7zjcgy3yovut18-bybi5arfvjsvv99nwh6pzltpw 192.168.10.211:2377 To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
-
查看swarm 信息
docker info
$ docker info Containers: 2 Running: 0 Paused: 0 Stopped: 2 ...snip... Swarm: active <-------------- NodeID: dxn1zf6l61qsb1josjja83ngz Is Manager: true Managers: 1 Nodes: 1 ...snip...
-
查看swarm 节点信息
docker node ls
$ docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS dxn1zf6l61qsb1josjja83ngz * manager1 Ready Active Leader
docker swarm join-token manager
docker info
docker@swarm-master:~$ docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS 1gb1blsr1wqpme4il8yiketj7 * swarm-master Ready Active Leader
转载于:https://my.oschina.net/u/915811/blog/1593840