version: '3.2'

services:
  agent:
    image: registry.edoc2.com:5000/edoc2v5/portainer-agent:v1.22.0.0
    environment:
      # REQUIRED: Should be equal to the service name prefixed by "tasks." when
      # deployed inside an overlay network
      AGENT_CLUSTER_ADDR: tasks.agent
      CAP_HOST_MANAGEMENT: 1
      # AGENT_PORT: 9001
      # LOG_LEVEL: debug
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /var/lib/docker/volumes:/var/lib/docker/volumes
      - /:/host
    networks:
      - agent_network
    deploy:
      mode: global
      placement:
        constraints: [node.platform.os == linux]

  portainer:
    image: registry.edoc2.com:5000/edoc2v5/portainer:v1.22.0.0
    command: -H tcp://tasks.agent:9001 --tlsskipverify --admin-password="$$2y$$05$$slU4oB.fMHn5R0AVgbVHQ.nAeyDqUUgESLvPRZ52fYlcwBiUiPJwu"
    ports:
      - "9000:9000"
      - "8000:8000"
    volumes:
      - portainer_data:/data
    networks:
      - agent_network
    deploy:
      mode: replicated
      replicas: 1
#      placement:
#        constraints: [node.labels.nodeportainer == Portainer]

networks:
  agent_network:
    driver: overlay
    attachable: true

volumes:
  portainer_data:

