docker_practice/swarm_mode/create.md

51 lines
1.8 KiB
Go
Raw Normal View History

# Swarm
2017-11-25 09:43:04 +08:00
2018-03-10 08:34:46 +08:00
[](overview.md) `Swarm` **** **** `Swarm`
2017-11-25 09:43:04 +08:00
##
2017-11-25 09:43:04 +08:00
Docker
2017-11-25 09:43:04 +08:00
```bash
$ docker swarm init --advertise-addr 192.168.99.100
2017-11-25 09:43:04 +08:00
Swarm initialized: current node (dxn1zf6l61qsb1josjja83ngz) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-49nj1cmql0jkz5s954yi3oex3nedyz0fb0xx14ie39trti4wxv-8vxv8rssmk743ojnwacrr2e7c \
192.168.99.100:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
```
Docker IP使 `--advertise-addr` IP
2018-03-10 08:34:46 +08:00
> `docker swarm init`
2017-11-25 09:43:04 +08:00
##
2017-11-25 09:43:04 +08:00
`Swarm` Docker
2017-11-25 09:43:04 +08:00
```bash
$ docker swarm join \
2017-11-25 09:43:04 +08:00
--token SWMTKN-1-49nj1cmql0jkz5s954yi3oex3nedyz0fb0xx14ie39trti4wxv-8vxv8rssmk743ojnwacrr2e7c \
192.168.99.100:2377
This node joined a swarm as a worker.
2017-11-25 09:43:04 +08:00
```
##
2017-11-25 09:43:04 +08:00
`Swarm`
使 `docker node ls`
```bash
$ docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
03g1y59jwfg7cf99w4lt0f662 worker2 Ready Active
9j68exjopxe7wfl6yuxml7a7j worker1 Ready Active
2018-03-10 08:34:46 +08:00
dxn1zf6l61qsb1josjja83ngz * manager Ready Active Leader
2017-11-25 09:43:04 +08:00
```