Skip to content

Latest commit

 

History

History
91 lines (74 loc) · 2.57 KB

portainer.md

File metadata and controls

91 lines (74 loc) · 2.57 KB

Portainer

Portainer 是一个开源、轻量级Docker管理用户界面,基于Docker API,提供状态显示面板、应用模板快速部署、容器镜像网络数据卷的基本操作(包括上传下载镜像,创建容器等操作)、事件日志显示、容器控制台操作、Swarm集群和服务等集中管理和操作、登录用户管理和控制等功能。功能十分全面,基本能满足中小型单位对容器管理的全部需求。

v2 安装

docker volume create portainer_data

Docker Standalone

docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce

Docker Swarm

curl -L https://downloads.portainer.io/portainer-agent-stack.yml -o portainer-agent-stack.yml
# 下载 https://downloads.portainer.io/portainer-agent-stack.yml
docker stack deploy -c portainer-agent-stack.yml portainer

v1.22x

新建 portainer-agent-stack.yml 文件, 将下面内容复制到配置文件中,你可以从官方仓库拷贝 portainer/portainer-compose 配置。

version: '3.2'
services:
  agent:
    image: portainer/agent
    environment:
      # REQUIRED: Should be equal to the service name prefixed by "tasks." when
      # deployed inside an overlay network
      AGENT_CLUSTER_ADDR: tasks.agent
      # AGENT_PORT: 9001
      # LOG_LEVEL: debug
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /var/lib/docker/volumes:/var/lib/docker/volumes
      - /etc/localtime:/etc/localtime:ro
    networks:
      - agent_network
    deploy:
      mode: global
      placement:
        constraints: [node.platform.os == linux]

  portainer:
    image: portainer/portainer
    command: -H tcp://tasks.agent:9001 --tlsskipverify
    ports:
      - "9000:9000"
    volumes:
      - portainer_data:/data
      - /etc/localtime:/etc/localtime:ro
    networks:
      - agent_network
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints: [node.role == manager]

networks:
  agent_network:
    driver: overlay
    attachable: true

volumes:
  portainer_data:

启动容器

docker stack deploy --compose-file=portainer-agent-stack.yml portainer

运行容器

docker run -d -p 8000:8000 -p 9000:9000 -p 9443:9443 \
  --name=portainer --restart=always \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v ~/_docker/portainer/data:/data \
  portainer/portainer-ce:latest