码迷,mamicode.com
首页 > 其他好文 > 详细

docker swarm 集群搭建

时间:2017-09-15 12:08:17      阅读:245      评论:0      收藏:0      [点我收藏+]

标签:docker




docker run -d -p 8300:8300 -p 8301:8301 -p 8301:8301/udp -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -p 8600:53 -p 8600:53/udp -h dev28 --restart=always --name=consul progrium/consul -server -bootstrap -ui-dir=/ui -advertise 192.168.30.71 -client 0.0.0.0




docker run -d --restart=always -p 8300:8300 -p 8301:8301 -p 8301:8301/udp -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -h dev30 --name=consul progrium/consul -join 192.168.30.71 -advertise 192.168.30.72 -client 0.0.0.0



docker run -d --restart=always --name=registrator --net=host -v /var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator -ip 192.168.30.72 consul://localhost:8500



docker run -tid -p 3375:3375 --restart=always --name shipyard-swarm-manager swarm:latest manage --host tcp://0.0.0.0:3375 consul://192.168.30.71:8500














yum install vim -y

yum install net-tools -y




[docker-main-repo]

    name=Docker main Repository

    baseurl=https://yum.dockerproject.org/repo/main/centos/7

    enabled=1

    gpgcheck=1

    gpgkey=https://yum.dockerproject.org/gpg





yum install docker-engine



systemctl stop firewalld.service

systemctl disable firewalld.service




vi /lib/systemd/system/docker.service


ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock -D -H tcp://0.0.0.0:2375





vim /etc/sysctl.conf


net.bridge.bridge-nf-call-ip6tables = 1

net.bridge.bridge-nf-call-iptables = 1

net.bridge.bridge-nf-call-arptables = 1



echo "net.bridge.bridge-nf-call-ip6tables = 1" >> /etc/sysctl.conf

echo "net.bridge.bridge-nf-call-iptables = 1" >> /etc/sysctl.conf

echo "net.bridge.bridge-nf-call-arptables = 1" >> /etc/sysctl.conf




docker swarm init --listen-addr 0.0.0.0:2377 --advertise-addr 192.168.30.79


docker swarm join \

>     --token SWMTKN-1-46ql6rcp9acghztlcjabobue0bp5gwlzwrbylnlcrk2os8gg1k-acxppwfzcrm0cvksshotw2kvn \

>     192.168.30.79:2377





docker run -d -p 8300:8300 -p 8301:8301 -p 8301:8301/udp -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -p 8600:53 -p 8600:53/udp -h dev28 --restart=always --name=consul progrium/consul -server -bootstrap -ui-dir=/ui -advertise 192.168.30.79 -client 0.0.0.0



docker run -d --restart=always -p 8300:8300 -p 8301:8301 -p 8301:8301/udp -p 8302:8302 -p 8302:8302/udp -p 8400:8400 -p 8500:8500 -h centos3 --name=consul progrium/consul -join 192.168.30.79 -advertise 192.168.30.84 -client 0.0.0.0



docker run -d --restart=always --name=registrator --net=host -v /var/run/docker.sock:/tmp/docker.sock gliderlabs/registrator -ip 192.168.30.79 consul://localhost:8500




10、启动swarm-manager(28)

docker run -tid -p 3375:3375 --restart=always --name shipyard-swarm-manager swarm:latest manage --host tcp://0.0.0.0:3375 consul://192.168.30.79:8500




docker run -tid --restart=always --name shipyard-swarm-agent swarm:latest join --addr 192.168.30.79:2375 consul://192.168.30.79:8500


docker swarm 集群搭建

标签:docker

原文地址:http://dek701.blog.51cto.com/600550/1965524

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!