Docker swarm mode with openSUSE Leap 42.1
OS: openSUSE Leap 42.1
3 個 node
- 1 個 manager node
- 2 個 worker node
# docker --version
Docker version 1.12.1, build 8eab29e
在 Manager node 上面
初始化 swarm, 如果有多張網卡就要使用 --advertise-add 指定 IP
# docker swarm init --advertise-addr 192.168.100.254
Swarm initialized: current node (bhmgljncagkfzsnhob3d9ricd) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-5iju0vxuje0wkczh52qdwa73k0xq3s6jd8coql0wrlogo57l5c-8nl9nbnxs192kgu09kotylwd8 \
192.168.100.254:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
使用 docker info 觀察 Swarm 啟動狀況
# docker info | grep Swarm
Swarm: active
檢查 node 資訊
# docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
bhmgljncagkfzsnhob3d9ricd * docker1 Ready Active Leader
在所有 worker node 上面
加入 swarm,
使用 剛剛 docker swarm init 顯示出來的資訊加入 ,或是使用 #docker swarm join-token work 查詢
# docker swarm join \
--token SWMTKN-1-5iju0vxuje0wkczh52qdwa73k0xq3s6jd8coql0wrlogo57l5c-8nl9nbnxs192kgu09kotylwd8 \
192.168.100.254:2377
在 Manager node 上面
檢查相關資訊
# docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
8268xbtnb28i9sy2tbkwlz7i0 docker2 Ready Active
bhmgljncagkfzsnhob3d9ricd * docker1 Ready Active Leader
ezwivow6sctk9wiit19g89fz7 docker3 Ready Active
到此 swarm mode 佈署成功
建立測試服務
參考文件