Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grafana crashes: /var/lib/grafana is not writable #1

Open
Stefan-Code opened this issue Nov 9, 2018 · 9 comments
Open

Grafana crashes: /var/lib/grafana is not writable #1

Stefan-Code opened this issue Nov 9, 2018 · 9 comments

Comments

@Stefan-Code
Copy link

When running docker-compose up grafana crashes with:

grafana_1        | GF_PATHS_DATA='/var/lib/grafana' is not writable.
grafana_1        | 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
grafana_1        | mkdir: cannot create directory '/var/lib/grafana/plugins': Permission denied

Pretty sure this is related to grafana/grafana-docker#154

@Stefan-Code
Copy link
Author

This can be solved by manually chown-ing the grafana directory on the host to 472:472, but there's got to be a better way.

@raul1991
Copy link

Even doing a chown does not fix it. I have fsGroup: 472 runAsUser: 472 and the directories belong to 472:472

@brianfeucht
Copy link

@raul1991 newer versions of grafana are using user 104 I had to chown 104:104 /data/grafana and it works with this in my docker compose:

  grafana:
    image: grafana/grafana:7.0.1
    volumes:
        - /data/grafana:/var/lib/grafana 
    ports:
        - "3000:3000"
    user: "104"

@raul1991
Copy link

@brianfeucht Thanks for.the update. Can you confirm if 472:472 works with version 6 of grafana.

@brianfeucht
Copy link

@raul1991 the change to uid:104 was made in v5.1 - http://grafana.com/docs/grafana/latest/installation/docker/#migrate-to-v5-1-or-later

I did confirm that chown 472:472 /data/grafana2 works with the following docker-compose config:

  grafana:
    image: grafana/grafana:7.0.1
    volumes:
        - /data/grafana2:/var/lib/grafana 
    ports:
        - "3000:3000"
    user: "472"

@juanmercadoit
Copy link

Hi all:

I had the same issue and solved with 2 steps:

  1. Identified the OS user and id.
  2. Change the docker compose.
  3. Run docker-compos fine without errors !

Example:

    image: grafana/grafana:latest
    container_name: monitoring_grafana
    user: "1014"

The User id

drwxr-xr-x  4 grafana root 4096 Feb  5 16:45 data/
drwxr-xr-x  3 grafana root 4096 Feb  5 17:47 var/

Working Fine !

@IIIdefconIII
Copy link

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

@devhero
Copy link

devhero commented Dec 5, 2023

user: "${UID}:${GID}" solves the permission issue
image: grafana/grafana:main use the most recent

grafana:
    image: grafana/grafana:main
    volumes:
        - /data/grafana:/var/lib/grafana 
    ports:
        - "3000:3000"
    user: "${UID}:${GID}"

@IIIdefconIII
Copy link

Or try chmod that folder to the correct guid and puid user but like the answer before it should work with puid guid environment values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants