| 1 | # docker-compose.yaml |
| 2 | version: "3" |
| 3 | |
| 4 | services: |
| 5 | prometheus: |
| 6 | image: prom/prometheus:latest |
| 7 | extra_hosts: |
| 8 | - "host.docker.internal:host-gateway" # allow a direct connection from container to the local machine |
| 9 | ports: |
| 10 | - "9090:9090" # the default port used by Prometheus |
| 11 | volumes: |
| 12 | - ${PWD}/prometheus.yaml:/etc/prometheus/prometheus.yml # mount Prometheus config file |
| 13 | |
| 14 | grafana: |
| 15 | image: grafana/grafana:latest |
| 16 | depends_on: |
| 17 | - prometheus |
| 18 | ports: |
| 19 | - "3000:3000" # the default port used by Grafana |