Centos7配置DockerSwarm及安装Portai-成都快上网建站

Centos7配置DockerSwarm及安装Portai

一、创建集群

1、初始化manager节点(xxx为manager的ip地址)

创新互联坚持“要么做到,要么别承诺”的工作理念,服务领域包括:成都网站设计、成都做网站、外贸网站建设、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的修水网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!

docker swarm init --advertise-addr xxx.xxx.xxx.xxx

会输出以下内容,注意加粗斜体命令,加入集群需要使用

Swarm initialized: current node (pk4p936t4e03cpse3izuws07s) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join --token xxx xxx.xxx.xxx.xxx:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

2、worker加入集群,在其他docker服务器运行上面命令

docker swarm join --token xxx xxx.xxx.xxx.xxx:2377

3、查看集群情况

docker node ls

Centos7配置Docker Swarm及安装Portai

二、安装Portainer

1、创建portainer-stack.yml文件

version: '3'
services:

  portainer:
    image: portainer/portainer
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "/data/portainer:/data"
    deploy:
      placement:
        constraints: [node.role == manager] # 控制管理界面部署在manager上
      replicas: 1
      restart_policy:
        condition: on-failure
      resources:
        limits:
          cpus: "0.2"
          memory: 200M
      labels: [svc=portainer]
    ports:
      - 9000:9000

2、启动portainer服务

docker stack deploy -c portainer-stack.yml portainer

3、访问portainer并修改密码(xxx为集群的任意一台ip,swarm会自动做负载均衡)

访问http://xxx.xxx.xxx.xxx:9000


标题名称:Centos7配置DockerSwarm及安装Portai
URL分享:http://kswjz.com/article/gesdgi.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流