version: '3.2'

services:
  agent:
    image: registry.vnfco.ir/library/portainer/agent:2.11.0
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /var/lib/docker/volumes:/var/lib/docker/volumes
    networks:
      - portainer_agent
    deploy:
      mode: global
      placement:
        constraints: [node.platform.os == linux]

  portainer:
    image: registry.vnfco.ir/library/portainer/portainer-ce:2.11.0
    command: -H tcp://tasks.agent:9001 --tlsskipverify
    ports:
      - "9443:9443"
      - "9000:9000"
      - "8000:8000"
    volumes:
      - /volume/portainer:/data
    networks:
      - portainer_agent
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints: [node.role == manager]

networks:
  portainer_agent:
    external: true