Dashboards are Inconsistent on Docker Compose Restart

Hi, I’m facing a strange issue with dashboard persistence when running Grafana in Docker. My dashboards seem to revert to an older state randomly after I restart my containers.

I will create and save a set of dashboards, and they work perfectly. However, when I stop and restart my stack using docker-compose down and then docker-compose up -d, one of two things happens:

  1. Sometimes, the correct, most recently saved dashboards appear.

  2. Other times, a completely different, older set of dashboards appears, and all my recent work is gone.

This seems to happen unpredictably. If I restart again, the “good” dashboards might reappear. Any advice?

Obvious question: so how do you handle persistence? Volume, db, grafana version,… you should provided details.

Here is the information about my setup:

  • Grafana Version: I’m using the grafana/grafana:latest Docker image.

  • Persistence Method: I am using the default built-in SQLite database, persisted to a Docker named volume.

  • Deployment: The entire stack is managed with Docker Compose on Windows with WSL2.


docker-compose.yml conf :

services:
grafana:
image: grafana/grafana:latest
container_name: grafana
ports:

  • “3001:3000”
    volumes:
  • grafana-data:/var/lib/grafana
    networks:
  • elastic-stack
    depends_on:
  • prometheus
  • elasticsearch
    restart: unless-stopped

volumes:
grafana-data:

Do you need something else ?

That’s only image version. What’s a Grafana version. Don’t assume latest image = latest Grafana version

My Grafana version is v12.0.2.

That SQLite is pure fs approach, so play it with that. Check some fsync options on your os and used docker storage driver, maybe sqllite level. I would try proper DB (postgres) they works better with with fs usually.

1 Like

thank you for the advice