Score:0

Persist Prometheus data from a Docker Container

us flag

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.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.