dockerprometheusdocker-desktopprometheus-alertmanagerprometheus-node-exporter

How to configure rules in prometheus file on docker in windows


I have prometheus container running on docker . I want to add a rule file in which i precise the rules .

This is my prometheus.yml file under c://mypath , I use this path in the commande to run the container by adding -v

enter image description here

enter image description here

i have in the same path a file rules.yml , but every time when i launch prometheus i can't find the rules in rules tab .

can anyone please help on how to configure rules in prometheus.yml when prometheus is running on docker .

the same config just work for me when i m using a simple localhost and not a container .

Thank you all !


Solution

  • You have only mounted prometheus.yml into /etc/prometheus/prometheus.yml but not rules.yml into container.

    Can you also mount your rules.yml into same path of container and try ?

    docker run -d --name prometheus -p 9123:9090 -v D:/prometheusVolumeDocker/prometheus.yml:/etc/prometheus/prometheus.yml -v D:/prometheusVolumeDocker/rules.yml:/etc/prometheus/rules.yml bitnami/prometheus