标签:docker swarm
一、Docker 部署2、安装docker 17ce版本包
[root@ docker]# yum install docker-engine –y
3、查看docker版本
[root@ docker]# docker --version
Docker version 17.05.0-ce, build 89658be
4、配置防火墙
5、在安装docker时,docker在/etc/下自动生成一个docker文件,导致docker启动时不能创建/etc/docker目录,不能生成/etc/docker/daemon.json 文件,所以不能启动,如果没有该文件没法同步docker镜像,创建文件后需要重启docker服务
[root@ docker]# cat /etc/docker/daemon.json
{
"insecure-registries":["docker-registry.istarshine.net.cn:5000"],
"log-driver":"json-file",
"log-opts":{"max-size":"1024m","max-file":"2"}
}
[root@ ~]# systemctl restart docker.service
二、加入docker集群
在manger管理主机上运行
1、查看管理主机token值
[root@filters5_191_6 ~]# docker swarm join-token worker
To add a worker to this swarm, run the following command:
docker swarm join --token SWMTKN-1-4p4djbee1kqcss8x5prfzg6v01x0y7hfa7rqob6rffg6e2p2wq-278qafb9ptpqtfebr0kyngi0b 192.168.191.6:2377
2、查看集群节点列表
[root@filters ~]# docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
0y4ga216x49nd9zt821afe45p * filters5_191_6 Ready Active Reachable
56mgklq3iyf0ajioytmtr0b44 filters5_191_10 Ready Active
b5mljua4e0tchrrk871ggbw7r filters5_191_7 Ready Active Reachable
gxm1gvh8lx2eja36a4cms9w98 filters5_182_212 Ready Active
hgweoxc5vmy9g30uyozmbumhj filters5_182_213 Ready Active
lluom23ugtfuiwphcye2frbmd filters5_182_215 Ready Active
om0ezdbqzdvavn8z8d844osbo filters5_182_214 Ready Active
t00tu1qs7wbll2fg2accsx7wf filters5_191_4 Ready Active Leader
tk89xphvsg16rz7b7l6lam4xv filters5_191_9 Ready Active
xbcx4hx2lq3ji8zog2ayzctat filters5_191_8 Ready Active Reachable
y3pnrw9jt69vkfiuxrs0co7ke filters5_191_5 Ready Active Reachable
在节点主机上运行
添加节点到docker集群
命令用法
docker swarm join --token <manger节点的token值> manger node ip:port
[root@dockernode~]#docker swarm join --token SWMTKN-1-4p4djbee1kqcss8x5prfzg6v01x0y7hfa7rqob6rffg6e2p2wq-278qafb9ptpqtfebr0kyngi0b 192.168.191.6:2377
标签:docker swarm
原文地址:http://blog.51cto.com/niming2008/2121359