I'm new to Docker and I'm playing with volumes, images, containers and so on.
One of my last attempt was to take some data inside a container and bring them to a volume so, if I would kill the container, I would be able to re-run with the same settings as before.
To copy the content from inside the container (it's a Grafana instance) to host I used
docker cp grafana:/var/lib/grafana /home/nicola/Documenti/
Then I created the new volume with the classic docker volume create grafana-storage
Then I attached the new volume to a temporary container
docker container create --name temp -v grafana-storage:/data bash
and then I copied the old data from my host to the volume
docker cp grafana temp:/data
and deleted the temporary container.
Now, if I run a new instance of grafana with the new volume like below
docker run -d -p 3000:3000 --name=grafana \
--volume grafana-storage:/var/lib/grafana \
grafana/grafana-oss
The container exits with the following error
GF_PATHS_DATA='/var/lib/grafana' is not writable.
You may have issues with file permissions, more information here: http://docs.grafana.org/installation/docker/#migrate-to-v51-or-later
mkdir: can't create directory '/var/lib/grafana/plugins': Permission denied
GF_PATHS_DATA='/var/lib/grafana' is not writable.
You may have issues with file permissions, more information here: http://docs.grafana.org/installation/docker/#migrate-to-v51-or-later
mkdir: can't create directory '/var/lib/grafana/plugins': Permission denied
What type of permissions do I need to set to the folder I copy inside the volume?