I'm running Prometheus and Grafana from docker-compose and basically it works. But I don't get my prometheus data to persist on my host machine.
As soon as I switch my volume settings from
---
version: "3.3"
services:
prometheus:
image: prom/prometheus:v2.43.0
container_name: prometheus
restart: unless-stopped
volumes:
- ./assets/config/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
- /etc/timezone:/etc/timezone:ro
command:
- "--config.file=/etc/prometheus/prometheus.yml"
ports:
- 9090:9090
volumes:
prometheus_data:
to
---
version: "3.3"
services:
prometheus:
image: prom/prometheus:v2.43.0
container_name: prometheus
restart: unless-stopped
volumes:
- ./assets/config/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- ./container_data/prometheus:/prometheus
- /etc/timezone:/etc/timezone:ro
command:
- "--config.file=/etc/prometheus/prometheus.yml"
ports:
- 9090:9090
the data is no longer visible in my Grafana UI and the now new container_data
folder on my host machine is empty.
Anyone got an idea how I can persist my data so that statistics survive a reboot of my docker-stack?
Addionally I would like to run Prometheus with the same user I use on my Ubuntu 22.10 host. But that is an afterthought for the moment.