docker swarn集群笔记

1.安装Docker 三剑客:
curl -L https://github.com/docker/machine/releases/download/v0.10.0/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine && chmod +x /tmp/docker-machine && sudo cp /tmp/docker-machine /usr/local/bin/docker-machine

yum -y install python-pip
pip install docker-compose

[[email protected] webapps]# docker swarm init --advertise-addr 10.60.10.39
Swarm initialized: current node (w45qdtntwrpr97ty8ldtu4sw7) is now a manager.

To add a worker to this swarm, run the following command:

    docker swarm join     --token SWMTKN-1-24911fv7pfba7781s1kjg381xhdsgs6amkrsfyiyp9qonhfmuk-0fgnqz2zi5yzwc7gs2d7ktasw     10.60.10.69:2377

To add a manager to this swarm, run ‘docker swarm join-token manager‘ and follow the instructions.

docker swarm join     --token SWMTKN-1-2rpog039x8lrihu3z1vpkaa9ju2klwsyujya7lhlr8gwzw4x1m-2t4e9l2ummijrj0769sk24mwl     10.60.10.39:2377

docker node ls

docker network create --driver overlay doceker_test_net01
docker network ls

#所有节点
docker pull nginx

docker service create --replicas 3 --name myNgx --network=doceker_test_net01 nginx

docker service ps myNgx
docker service ls
docker service scale myNgx=2

docker service update --image nginx myNgx

docker service rm myNgx
时间: 2024-08-29 20:59:10

docker swarn集群笔记的相关文章

云计算之路-阿里云上-容器难容:自建docker swarm集群遭遇无法解决的问题

我们从今年6月开始在生产环境进行 docker 容器化部署,将已经迁移至 ASP.NET Core 的站点部署到 docker swarm 集群上.开始我们选用的阿里云容器服务,但是在使用过程中我们遭遇了恐怖的路由服务(acsrouting)路由错乱问题 —— 请求被随机路由到集群中的任一容器,虽然后来阿里云修复了这个问题,但我们对容器服务失去了信心,走上了用阿里云服务器自建 docker swarm 集群的道路. 用上自建 docker swarm 集群之后,本以为可以在云上容器中过上安稳的日

docker swarm集群及其UI部署

一.规划 ①swarm01作为manager节点,swarm02和swarm03作为worker节点. # cat /etc/hosts 127.0.0.1   localhost 192.168.139.175  swarm01  192.168.139.176  swarm02  192.168.139.177  swarm03 ②配置SSH免密登陆 # ssh-keygen -t rsa -P '' # ssh-copy-id -i .ssh/id_rsa.pub [email prote

非节点主机通过内网远程管理docker swarm集群

这是今天使用 docker swarm 遇到的一个问题,终于在睡觉前解决了,在这篇随笔中记录一下. 在 docker swarm 集群的 manager 节点上用 docker cli 命令可以正常管理集群.但是在另外一台不是集群节点的主机上,虽然设置了DOCKER_HOST环境变量 export DOCKER_HOST="tcp://manger节点内网IP:2377" 但连接不上 # docker ps Cannot connect to the Docker daemon at

Docker Swarm集群部署应用

在Docker Swarm集群部署应用 我们过去使用docker run的命令创建容器, 把前面替换成docker service create就行了. 建议搭建一个registry,为所的docker主机提供镜像下载,否则你需要在每个docker主机本地存在容器镜像. 所以搭建一个私有仓库,由私有仓库提供所需要的镜像, 本实验环境中用node1同时作为registry. 拉取本地私有仓库registry,查看registry镜像 基础环境 全部为CentOS7系统,Docker 版本为1.12

docker swarm集群部署

docker swarm 集群构建: swarm 在docker 1.12 版本后内置 #h官方文档tps://docs.docker.com/engine/swarm/#feature-highlights 系统环境: centos7.3 docker17.06 1.初始化manager节点: docker swarm init 为实现高可用,manager节点需要有奇数个,类似zookerper选举制度. 2.复制生成的命令,在node节点运行. #docker swarm join-tok

故障公告:docker swarm集群“群龙无首”造成部分站点无法访问

今天傍晚 17:38-18:18 左右,由于 docker swarm 集群出现 "The swarm does not have a leader" 问题,造成博问.闪存.园子.小组.openapi 无法正常访问,由此给您带来麻烦,请您谅解. 目前我们已经迁移至 asp.net core 的站点都部署在 docker swarm 集群上,节点用的是阿里云服务器,操作系统是 ubtunu 16.04 ,docker engine 版本是 17.06.0-ce, build 02c1d8

通过docker-machine和etcd部署docker swarm集群

本片文章介绍一下 使用docker-machine 搭建docker swarm 集群:docker swarm是docker 官方搭建的容器集群编排工具:容器编排,就是可以使你像使用一太机器一样来使用一个集群,你运行的容器可能会在容器中的任何一个节点上运行: 首先盗一张 docker swarm的架构图: 图片来源 https://yeasy.gitbooks.io/docker_practice/content/swarm/intro.html 在使用 Swarm 管理docker 集群时,

从零开始搭建Docker Swarm集群

从零开始搭建Docker Swarm集群 检查节点Docker配置 1. 打开Docker配置文件(示例是centos 7)vim /etc/sysconfig/docker 2. 添加-H tcp://0.0.0.0:2375到OPTIONSOPTIONS='-g /cutome-path/docker -H tcp://0.0.0.0:2375' 3. CentOS6.6 需要另外添加-H unix:///var/run/docker.sockOPTIONS='-g /mnt/docker 

云计算之路-阿里云上:重启 manager 节点引发 docker swarm 集群宕机

为了迎接春节假期后的访问高峰,我们今天对 docker swarm 集群进行了变更操作,购买了1台阿里云4核8G的服务器作为 worker 节点,由原来的  3 manager nodes + 2 worker nodes 变为  3 manager nodes + 3 worker nodes . 晚上,我们对已经持续运行一段时间的5个节点逐一进行重启操作,重启方式如下: 1)docker node update --availability drain 让节点下线2)阿里云控制台重启服务器3