How to make Grafana container data persistent

0 votes

Hi Guys,

I have created one docker container for Grafana. But whenever I removed the container the database also erased automatically. But I want to connect the same database to a different container. How can I make the Grafana database persistent?

Sep 6, 2020 in Docker by akhtar
• 38,180 points
1,355 views

1 answer to this question.

0 votes

Hi@akhtar,

You need to create a volume in Docker and mount the same volume to your docker container. Then only your database will not erase. You can use the below commands. 

  • Create a persistent volume for your data in /var/lib/grafana (database and plugins) 

$ docker volume create grafana-storage 
  • Start Grafana container

$ docker run -d -p 3000:3000 --name=grafana -v grafana-storage:/var/lib/grafana grafana/grafana
answered Sep 6, 2020 by MD
• 95,140 points

Related Questions In Docker

0 votes
1 answer

How to Backup, Restore or Migrate data volumes in a docker container?

Steps to Backup a container 1)     ...READ MORE

answered Jul 3, 2019 in Docker by Sirajul
• 59,030 points
10,602 views
+4 votes
4 answers

How To Access a Service on Host From a Docker Container?

Adding to kalgi's answer, You can also ...READ MORE

answered Oct 16, 2018 in Docker by lina
• 8,220 points

edited Oct 16, 2018 by lina 21,202 views
0 votes
1 answer

How to run a docker command from inside the container?

You must have come across the /var/run/docker.sock file, ...READ MORE

answered Jun 28, 2018 in Docker by Sophie may
• 10,550 points
1,837 views
0 votes
1 answer

How to store data in external drive with Docker Postgres:9.3 image?

Apparently, the problem would be in your ...READ MORE

answered Jul 12, 2018 in Docker by Kalgi
• 2,680 points
1,138 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,100 points
1,108 views
0 votes
1 answer

How can I connect a docker container to two docker networks that I have created?

Hi@akhtar, It's correct that the network argument of ...READ MORE

answered Mar 23, 2020 in Docker by MD
• 95,140 points
896 views
0 votes
1 answer

How to expose my docker container?

Hi@akhtar, To expose you container from outside you ...READ MORE

answered Apr 6, 2020 in Docker by MD
• 95,140 points
166 views