version: '3.8' services: prometheus: image: prom/prometheus # needed if mounted in custom volume user: root volumes: - "./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml" - "${PROMETHEUS_DATA_DIR:?specify data dir in .env file}:/prometheus" restart: always extra_hosts: - "host.docker.internal:host-gateway" ports: - 9090:9090 grafana: build: context: ./grafana user: root restart: always extra_hosts: - "host.docker.internal:host-gateway" ports: - 9000:3000 volumes: - ${GRAFANA_DATA_DIR:?specify data dir in .env file}:/var/lib/grafana