#简单介绍如下几点:
# XFS 默认文件系统更新为 overlay2
Server Version: 1.13.0
Storage Driver: overlay
Backing Filesystem: xfs
# 添加 service 容器互通 ping 支持
# service 创建 添加 hostname
docker service create --hostname
# 正式支持 docker stack
# 支持docker-compose version 3
docker stack deploy
安装 docker 1.13
1
2
3
4
5
6
7
8
9
10
wget -qO- https://get.docker.com/ | sh
#修改 配置
sed -i 's/dockerd/dockerd --graph=\/opt\/docker\/images/g' /lib/systemd/system/docker.service
systemctl daemon-reload
systemctl restart docker.service
systemctl enable docker.service
创建 swarm
Swarm init
1
2
3
4
5
6
7
8
9
10
11
[root@swarm-node-1 ~]#docker swarm init --advertise-addr 10.6.0.140
Swarm initialized: current node (hf0h3qnlsicf5x6bltubjxgtg) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-26a59cyiceqq93w79abuyuaifkr2pxbsj41k9gas0ttxfrcw4x-an3tg2qodlh8noc8fx4zwniic \
10.6.0.140:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
Swarm join
1
2
3
4
5
6
7
8
9
10
11
12
[root@swarm-node-2 ~]#docker swarm join \
> --token SWMTKN-1-26a59cyiceqq93w79abuyuaifkr2pxbsj41k9gas0ttxfrcw4x-an3tg2qodlh8noc8fx4zwniic \
> 10.6.0.140:2377
This node joined a swarm as a worker.
[root@swarm-node-3 ~]#docker swarm join \
> --token SWMTKN-1-26a59cyiceqq93w79abuyuaifkr2pxbsj41k9gas0ttxfrcw4x-an3tg2qodlh8noc8fx4zwniic \
> 10.6.0.140:2377
This node joined a swarm as a worker.
1
2
3
4
5
[root@swarm-node-1 ~]#docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
e5b6fq2gfv3fex37q06974kg6 swarm-node-2 Ready Active
hf0h3qnlsicf5x6bltubjxgtg * swarm-node-1 Ready Active Leader
zfniuw09nktpqdyswulnxemqt swarm-node-3 Ready Active
overlay network
1
2
3
4
5
6
7
8
9
10
11
# 创建一个 overlay 网络
[root@swarm-node-1 ~]#docker network create --driver overlay --opt encrypted --subnet=10.0.9.0/24 my-net
vxdbvrbvxcpep6sk6mtfy3nlp
[root@swarm-node-1 ~]#docker network ls
NETWORK ID NAME DRIVER SCOPE
vxdbvrbvxcpe my-net overlay swarm