Hello all,
I am trying to get my Grafana docker container to persist data. I’ve configured the container to run as root to rule out any user account related issues. I’m not sure what I’m doing wrong but I can’t get the data to persist.
I can remove panels from the default Home dashboard. If I create a custom dashboard everything seems to be OK but as soon as I log out and re-login (to the default admin account) it is as if I’m logging in for the first time.
What am I doing wrong? Initially, the container complained about not finding directories (dashboard, datasources and notifiers) within the provisioning directory which I expected it to create under /etc/grafana so to overcome that I added the last binding and manually created these directories under the provisioning directory.
Have you made the data directories first? Are the permissions on them correct? Personally i hate using $PWD and always set a full path. I like using /docker_data as it makes it obvious to anyone after me what it is.
I suggest you use ansible-vault to not save passwords in plain text.
This should give you a good start, there are some files you will need to create, they are mainly your current config files saved as .jk2 or j2 (where I forgot the k). The dashborads I auto deploy can be removed or you can go to the Grafana page for them and download the yml.
Thank you very much for your help.
Since posting, I noticed that I am able to create and save dashboards etc. What I cannot do is reset the admin password (it keeps prompting me to change it every time" I also cannot seem to be able to edit the main “home” dashboard.
I thought it had something to do with Grafana being behind Traefik so I tested a standalone container with port 3000 exposed on http and found that it did the same thing so I know for sure it’s not Traefik.
Hey! For me, I had Grafana listening to Prometheus in a docker container. Although I created a volume for Grafana, I did not create a volume for Prometheus. Since Prometheus’ data was reset every time, Grafana also lost all the data as a result. Simply adding a volume to persist Prometheus data fixed the issue for me, as detailed here: persistence - How to persist data in Prometheus running in a Docker container? - Stack Overflow