version: "3.7" networks: autoscale: configs: prometheus_config: file: ./prometheus.yml services: docker-swarm-autoscaler: image: jcwimer/docker-swarm-autoscaler:0.1.0 volumes: - /var/run/docker.sock:/var/run/docker.sock:ro environment: - PROMETHEUS_URL=http://prometheus:9090 networks: - autoscale deploy: mode: replicated replicas: 1 placement: constraints: - node.role == manager resources: limits: cpus: '0.10' memory: 128M reservations: cpus: '0.10' memory: 64M cadvisor: image: google/cadvisor:${CADVISOR_VERSION:-v0.25.0} networks: - autoscale volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - /:/rootfs:ro - /var/run:/var/run:ro - /sys:/sys:ro - /var/lib/docker/:/var/lib/docker:ro - /dev/disk/:/dev/disk:ro deploy: mode: global resources: limits: cpus: '0.10' memory: 128M reservations: cpus: '0.10' memory: 64M prometheus: image: prom/prometheus:v2.12.0 networks: - autoscale command: ["--storage.tsdb.retention.size=1GB", "--config.file=/etc/prometheus/prometheus.yml", "--web.console.libraries=/etc/prometheus/console_libraries", "--web.console.templates=/etc/prometheus/consoles", "--web.enable-lifecycle"] configs: - source: prometheus_config target: /etc/prometheus/prometheus.yml deploy: mode: replicated replicas: 1 placement: constraints: - node.role == manager resources: limits: cpus: '0.50' memory: 1024M reservations: cpus: '0.50' memory: 128M