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 7, 2020 in Docker by akhtar
• 38,210 points

1 answer to this question.

0 votes


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 7, 2020 by MD
• 95,300 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,070 points
+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 24,176 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
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
+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,140 points
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,300 points
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,300 points