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

In the past I have made a grafana install with docker using the following procedure:
Docker version (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
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      

❯ 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?