docker-compose.yml
version: '3'
services:
  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    restart: unless-stopped
    environment:
      - --web.enable-admin-api
    volumes:
      - $PWD/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
    depends_on:
      - node-exporter
      - cadvisor
    networks:
      - proxy
    #labels:
    #  - "traefik.enable=true"
    #  - "traefik.http.routers.prometheus.rule=Host(`prometheus.example.com`)"
    #  - "traefik.http.routers.prometheus.entrypoints=websecure"
    #  - "traefik.http.routers.prometheus.tls.certresolver=myresolver"
    #  - "traefik.http.services.prometheus.loadbalancer.server.port=9090"
    #  - "traefik.http.routers.prometheus.middlewares=authprometheus"
    #  - "traefik.http.middlewares.authprometheus.basicauth.users=user1:pwdhash1"
      
  snmp-exporter:
    image: prom/snmp-exporter:latest
    container_name: snmp-exporter
    #restart: unless-stopped
    volumes:
      - ./snmp-exporter:/etc/snmp_exporter
    ports:
      - 9116:9116
      - 116:116/udp
    command: --config.file=/etc/snmp_exporter/snmp.yml
    networks:
      - proxy
    #network_mode: "host"
    
  node-exporter:
    image: prom/node-exporter:latest
    container_name: node-exporter
    restart: unless-stopped
    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro
    command:
      - '--path.procfs=/host/proc'
      - '--path.sysfs=/host/sys'
      - '--path.rootfs=/rootfs'
      - '--collector.filesystem.ignored-mount-points="^(/rootfs|/host|)/(sys|proc|dev|host|etc)($$|/)"'
      - '--collector.filesystem.ignored-fs-types="^(sys|proc|auto|cgroup|devpts|ns|au|fuse\.lxc|mqueue)(fs|)$$"'
    networks:
      - proxy
      
  cadvisor:
    image: google/cadvisor:latest
    container_name: cadvisor
    restart: unless-stopped
    volumes:
      - /:/rootfs:ro
      - /var/run:/var/run:rw
      - /sys:/sys:ro
      - /var/lib/docker/:/var/lib/docker:ro
    networks:
      - proxy
    #labels:
    #  - "traefik.enable=true"
    #  - "traefik.http.routers.cadvisor.rule=Host(`cadvisor.example.com`)"
    #  - "traefik.http.routers.cadvisor.entrypoints=websecure"
    #  - "traefik.http.routers.cadvisor.tls.certresolver=myresolver"
    #  - "traefik.http.services.cadvisor.loadbalancer.server.port=8080"
    #  - "traefik.http.routers.cadvisor.middlewares=authcadvisor"
    #  - "traefik.http.middlewares.authcadvisor.basicauth.users=user1:pwdhash1"
      
  pushgateway:
    image: prom/pushgateway
    container_name: pushgateway
    restart: unless-stopped
    networks:
      - proxy

networks:
  proxy:
    external: true