docker swarm 集群高可用

docker
yum install docker
service docker start
chkconfig docker on
systemctl start docker.service
systemctl enable docker.service
docker-machine -s "K:\docker" create --engine-registry-mirror=https://f5bw1ll2.mirror.aliyuncs.com -d virtualbox default
docker run --name=postgresql-redmine -d --env='DB_NAME=redmine_production' --env='DB_USER=redmine' --env='DB_PASS=password' --volume=/srv/docker/redmine/postgresql:/var/lib/postgresql sameersbn/postgresql:9.4-21
docker run --name=redmine -d --link=postgresql-redmine:postgresql --publish=10083:80 --env='REDMINE_PORT=10083' --volume=/srv/docker/redmine/redmine:/home/redmine/data sameersbn/redmine
docker start postgresql-redmine
docker start redmine
gem install bundler --no-rdoc --no-ri
bundle exec rake redmine:plugins:migrate RAILS_ENV=production
wget http://projects.andriylesyuk.com/attachments/download/563/redmine_scm-0.5.0b.tar.bz2

docker exec -it f852c5a17c03 /bin/zsh

docker pull sameersbn/gitlab:latest
docker run --name=gitlab-postgresql -d --env='DB_NAME=gitlabhq_production' --env='DB_USER=gitlab' --env='DB_PASS=sqeven' --env='DB_EXTENSION=pg_trgm' --volume=/srv/docker/gitlab/postgresql:/var/lib/postgresql sameersbn/postgresql:latest
docker run --name=gitlab-redis -d --volume=/srv/docker/gitlab/redis:/var/lib/redis sameersbn/redis:latest
docker run --name gitlab -d --link gitlab-postgresql:postgresql --link gitlab-redis:redisio --publish 10022:22 --publish 10080:80 --env 'GITLAB_PORT=10080' --env 'GITLAB_SSH_PORT=10022' --env 'GITLAB_HOST=47.92.131.19' --env 'GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string' --env 'GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alpha-numeric-string' --env 'GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alpha-numeric-string' --volume /srv/docker/gitlab/gitlab:/home/sqeven/data sameersbn/gitlab:latest
docker run --name gitlab -d --link gitlab-postgresql:postgresql --link gitlab-redis:redisio --publish 10022:22 --publish 10080:80 --env 'GITLAB_PORT=10080' --env 'GITLAB_SSH_PORT=10022' --env 'GITLAB_HOST=192.168.99.100' --env 'GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string' --env 'GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alpha-numeric-string' --env 'GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alpha-numeric-string' --volume /srv/docker/gitlab/gitlab:/home/sqeven/data sameersbn/gitlab:latest
docker start gitlab-redis
docker start gitlab-postgresql
docker start gitlab
yum install python-setuptools
git clone https://github.com/tv42/gitosis.git
python setup.py install
useradd -c 'git version manage' -m -d /home/git -s /bin/bash gitocm
sudo -H -u gitocm gitosis-init < /home/git/id_rsa.pub
sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update
git clone gitocm@47.92.131.19:gitosis-admin.git
[group ocm]
writable = ocm
members = victor@ocm.cc recwert@ocm.cc
git remote add origin gitocm@47.92.131.19:ocm.git
http://47.92.131.19:10080/root/ocm.git
http://47.92.131.19:10080/root/ocm.git

systemctl stop firewalld
yum install iptables-services
systemctl enable iptables
systemctl start iptables
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh --mirror Aliyun
systemctl enable docker
systemctl start docker
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://f5bw1ll2.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
docker swarm 4ceb807fb6d566a84a82ccc686726560
docker run --rm swarm create
docker run -d swarm join --addr=120.76.147.220:2375 token://4ceb807fb6d566a84a82ccc686726560
docker run -d swarm join --addr=123.207.51.88:2375 token://4ceb807fb6d566a84a82ccc686726560
docker run --rm swarm list token://4ceb807fb6d566a84a82ccc686726560
docker run -d -p 8888:2375 swarm manage token://4ceb807fb6d566a84a82ccc686726560
docker -H 120.76.147.220:8888 info
docker -H 120.76.147.220:8888 run -d --name web1 nginx
iptables -I INPUT -s 123.207.51.88 -p tcp --dport 2375 -j ACCEPT
iptables -I INPUT -s 120.76.147.220 -p tcp --dport 2375 -j ACCEPT
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker inspect container_name | grep Mounts -A 20
docker run --name sqeven -itd -p 21:21 -p 80:80 -p 443:443 -p 3306:3306 sqeven/docker-oneinstack
curl --fail -L -O https://github.com/phusion/baseimage-docker/archive/master.tar.gz && \
tar xzf master.tar.gz && \
sudo ./baseimage-docker-master/install-tools.sh
docker login --username=sqeven --email=sqeven@qq.com
FROM centos
MAINTAINER sqeven<admin@sqeven.com>
RUN yum -y update && yum -y install wget screen curl python git gcc python-devel python-pip
wget http://mirrors.linuxeye.com/oneinstack-full.tar.gz
docker build -t sqeven/sqeven .
docker run -it --rm sqeven/sqeven bash
docker exec -it sqeven/sqeven bash
docker run --name sqeven -itd -p 21:21 -p 80:80 -p 443:443 -p 3306:3306 sqeven/sqeven
docker swarm init --advertise-addr 123.207.51.88
docker swarm join --token SWMTKN-1-42b4370e78htn3nwgiubb6p3nyx1cuhw7u3mmtatv190mtyhxo-2cj13sjec4afyfdloi774d0hs 123.207.51.88:2377
docker node ls
docker network create --driver overlay seven
docker service create --replicas 3 -p 80:80 --name nginx nginx:1.13.7-alpine
docker service create --replicas 1 -p 80:80 -p 443:443 -p 3306:3306 --name sqeven --network=seven sqeven/sqeven:seven
docker service ls
docker service ps
docker service logs nginx
docker service rm seven
docker service tasks seven
docker service scale sqeven=3
yum -y install iptables-services
systemctl enable iptables
iptables -A INPUT -p tcp --dport 2377 -j ACCEPT
iptables -A INPUT -p tcp --dport 2376 -j ACCEPT
iptables -A INPUT -p tcp --dport 7946 -j ACCEPT
iptables -A INPUT -p udp --dport 7946 -j ACCEPT
#iptables -A INPUT -p tcp --dport 4789 -j ACCEPT
iptables -A INPUT -p udp --dport 4789 -j ACCEPT
###########################################$######
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 2377 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 7946 -j ACCEPT
-A INPUT -p udp -m state --state NEW -m udp --dport 7946 -j ACCEPT
-A INPUT -p udp -m state --state NEW -m udp --dport 4789 -j ACCEPT
###################################################################
firewall-cmd --add-port=2376/tcp --permanent
firewall-cmd --add-port=2377/tcp --permanent
firewall-cmd --add-port=7946/tcp --permanent
firewall-cmd --add-port=7946/udp --permanent
firewall-cmd --add-port=4789/udp --permanent

#docker# #swarm#

评论2

  • 1:docker-compose stop
    2:docker-compose rm -f
    3:docker rmi 三个对应的镜像log mysql ui
    4:rm -rf /data/database/*
    5:rm -rf /data/registry/*
    6:docker-compose build
    7:docker-compose up -d
    2017-12-04 18:40:54 回复
  • docker-compose down
    rm -r /data/secretkey
    ./prepare
    docker-compose up -d
    2017-12-04 18:46:37 回复
评论请先登录

最近热帖

  1. 基于 Harbor 搭建 Docker 私有镜像仓库 317576
  2. PPS代理节点池 192468
  3. PPS代理节点池② 110070
  4. PPS代理节点池③ 73377
  5. 订阅池记录 64712
  6. V2ray免费账号 11514
  7. WEB代理地址 2838
  8. 全栈开发笔记 2610
  9. 百度的无刷新搜索之PJAX 1942
  10. GITHUB项目 1826

近期热议

  1. GITHUB项目 55
  2. PPS代理节点池 50
  3. WEB代理地址 43
  4. 全栈开发笔记 42
  5. ROBOT机器人之路 31
  6. PPS代理节点池③ 26
  7. PPS代理节点池② 20
  8. C++回归之路 19
  9. OCR识别探索 16
  10. 错误笔记本 14