version: '3.2'
services:
  main:
    image: portainer/portainer-ce
    command: -H tcp://tasks.agent:9001 --tlsskipverify
    ports:
      - "9000:9000"
    volumes:
      - data:/data
    networks:
      - agent
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints: [node.hostname == vch1]
  agent:
    image: portainer/agent
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /var/lib/docker/volumes:/var/lib/docker/volumes
    networks:
      - agent
    deploy:
      mode: global
      placement:
        constraints: [node.platform.os == linux]
networks:
  agent:
    driver: overlay
    attachable: true
volumes:
  data: