---

version: '2'
services:
{% for collector in collectors %}
{% if gpus > 0 or not collector.gpu %}
  collector-{{ collector.name }}:
    image: {{ collector.image }}
    restart: unless-stopped
{% if 'network_mode' in collector %}
    network_mode: {{ collector.network_mode }}
{% endif %}
{% if collector.gpu %}
    devices:
      - "/dev/nvidiactl:/dev/nvidiactl"
      - "/dev/nvidia-uvm:/dev/nvidia-uvm"
      - "/dev/nvidia-uvm-tools:/dev/nvidia-uvm-tools"
{% for gpu in range(gpus)%}
      - "/dev/nvidia{{ gpu }}:/dev/nvidia{{ gpu }}"
{% endfor %}
{% endif %}
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "/etc/hostname:/etc/hostname"
      - "/sys:/sys"
      - "/usr/src:/usr/src"
      - "/lib/modules:/lib/modules"
{% if collector.gpu %}
      - "/usr/bin/nvidia-smi:/usr/bin/nvidia-smi:ro"
{% for lib in nvidia_libs.files %}
      - "{{ lib['path'] }}:{{ lib['path'] }}:ro"
{% endfor %}
{% endif %}
    privileged: true
    pid: "host"
    command: []
{% endif %}
{% endfor %}

