Make persistant volume in Docker

Hello,

I want to run grafana as aDocker image, but I have a permission problem, this is my docker compose configuration:

version: ‘3’
services:
grafana:
image: grafana/grafana
container_name: grafana
restart: always
volumes:
- $PWD/docker_data/grafana/data:/var/lib/grafana
- $PWD/docker_data/grafana/config:/etc/grafana
ports:
- 3000:3000
links:
- influxdb

This is the logs:

GF_PATHS_CONFIG=’/etc/grafana/grafana.ini’ is not readable.
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/#migration-from-a-previous-version-of-the-docker-container-to-5-1-or-later
t=2020-03-24T15:14:37+0000 lvl=crit msg=“Failed to parse /etc/grafana/grafana.ini, open /etc/grafana/grafana.ini: no such file or directory”

And this is the file permissions:

~$ ls -lh docker_data/grafana/
total 8,0K
drwxr-xr-x 2 root root 4,0K mar 24 15:54 config
drwxr-xr-x 3 root root 4,0K mar 24 16:10 data

I read the https://grafana.com/docs/grafana/latest/installation/docker/#migration-from-a-previous-version-of-the-docker-container-to-5-1-or-later web, but I can get it working.

Anyone have a solution for this?

Kind regards.

Hello again,

I solve partlly with external volumes:

version: ‘3’
services:
grafana:
image: grafana/grafana
container_name: grafana
restart: always
volumes:
- grafana-data:/var/lib/grafana
- grafana-config:/etc/grafana
ports:
- 3000:3000
links:
- influxdb

volumes:
grafana-data:
grafana-config:

But this is not the way I want to get it. I can not configure the patch of my volumes.

How could I configure the volumes in a desired path?

Kind regards.

Hi @zorrua , were you able to get around this issue?
Thanks,