Backup restore or migration of grafana docker container and volume to another desktop

Hi
In the past I have made a grafana install with docker using the following procedure:
Docker version 2.3.0.3 (45519) MAC OSX v10.15.5 (Catalina)

Run Grafana container with persistent storage (recommended)

# create a persistent volume for your data in /var/lib/grafana (database and plugins)
docker volume create grafana-storage

# start grafana
docker run -d -p 3000:3000 --name=grafana -v grafana-storage:/var/lib/grafana grafana/grafana

I am using a MAC OS X Catalina on both computers.

In order to backup the grafana instance I used the command below:

docker container export grafana-lab > grafana-lab.tar
and
docker container export --output grafana-lab-bkp <containerid> 

To restore the container in the new computer I used the command below:

❯ docker import grafana-lab-bkp grafana-lab      
output: 
sha256:b64b8a9984ad24b789afea30a72535e1d447c06df9(...)

❯ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
grafana-lab         latest              b64b8a9984ad        About a minute ago   237MB

My questions are:

  • How should I proceed in order to be able to restore a container with its volume as I created using the “recommended” approach?
  • Is there a viable alternative like with grafana-cli can I generate / export a json file with all its contents and import it on another grafana?

Thanks.

Did you ever figure out the answer to this?

I just realized my grafana volume is not being backed up, that it’s not even enough to backup the /etc/grafana from the running container (one way or another), and there is nothing in the UI to backup and restore everything.

Also I’m using docker-compose, and have volumes specified in my yaml file.

Hi @patman,

The original post is almost 3 years old so not sure if the user will reply back :slight_smile:

However, there is this post where many different community users shared useful information as to how to back n restore for migration in the Docker container:

https://localhost:3000/t/how-to-move-migrate-grafana-to-a-newer-version-system-on-a-local-container-environment/13822/8

In case if you run into issues after following it then ask there as the users still seems to be active.

I hope this helps.

1 Like