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.