一、Portainer架构

二、基于Docker-Compose部署

# vim docker-compose.yaml 
version: '3'

services:
  portainer-server:
    image: portainer/portainer-ce:latest
    container_name: portainer-server
    restart: always
    ports:
      - 9000:9000
      - 8000:8000
    networks:
      - ops_default
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer_data:/data

volumes:
  portainer_data:

networks:
  ops_default:
    external: true

# 启动服务
docker-compose up -d

# 查看服务启动状态
docker-compose ps

三、Agent部署

# cat docker-compose.yaml 
version: '3'

services:
  portainer-agent:
    image: portainer/agent:latest
    container_name: portainer-agent
    restart: always
    ports:
      - 9001:9001
    networks:
      - ops_default
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /var/lib/docker/volumes:/var/lib/docker/volumes

networks:
  ops_default:
    external: true

# 启动服务
docker-compose up -d

# 查看服务启动状态
docker-compose ps

四、登录服务端增加Agent

参考:https://github.com/portainer/portainer

posted on 2023-01-19 14:20  a120608yby  阅读(74)  评论(0编辑  收藏  举报