docker swarm部署portainer registry

docker swarm部署本地仓库registry与portainer

docker swarm 2个节点

ljh1 192.168.8.88 manager

ljh2 192.168.8.98 worker

创建overlay网络

docker network create -d overlay platform

添加host标签

docker node update ljh1  --label-add host=ljh1
docker node update ljh2  --label-add host=ljh2

docker swarm部署本地仓库

1.数据卷挂载registry数据目录

mkdir -p /usr/local/registry
chmod -R 777 /usr/local/registry

2.创建docker-swarm配置文件

设置对接网络为platform,platform为外部网络

version: '3.6'

services:
  registry:
    image: registry:2.7.1
    ports:
      - "5000:5000"
    volumes:
      - /usr/local/registry:/var/lib/registry
    networks:
      - platform
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints: [node.labels.host == ljh2]
        
networks:
  platform:
    external: true

3.部署registry

docker stack deploy -c docker-registry.yml registry
4.验证

http://192.168.8.98:5000/v2/_catalog

docker swarm部署portainer

1.数据卷挂载registry数据目录
mkdir -p /usr/local/portainer
chmod -R 777 /usr/local/portainer
2.创建docker-swarm配置文件
version: "3.6"
services:
  portainer:
    image: portainer/portainer
    ports:
      - "9000:9000"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "/usr/local/portainer:/data"
    networks:
      - platform
    deploy:
      replicas: 1
      placement:
        constraints: [node.role == manager]

networks:
  platform:
    external: true
3.部署portainer
docker stack deploy -c docker_portainer.yml portainer
4.验证

http://ljh1:9000

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值