SaiUpadhyayula / spring-boot-microservices

This repository contains the latest source code of th spring-boot-microservices tutorial

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Grafana container errors `GF_PATHS_DATA='/var/lib/grafana' is not writable.`

thachpham2k opened this issue · comments

🐛 Issue Title: Fix Grafana container error

Description:
When running the Grafana container, the following error occurs:

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

Solution:
To resolve this issue, add user: '0' to the docker-compose.yml file for the Grafana service:

 grafana:
  image: grafana/grafana-oss:10.2.4
  container_name: grafana
  restart: always
  ports:
    - "3000:3000"
  links:
    - prometheus:prometheus
  volumes:
    - ./grafana:/var/lib/grafana
  environment:
    - GF_SECURITY_ADMIN_USER=admin
    - GF_SECURITY_ADMIN_PASSWORD=admin
  user: '0'

This will run the Grafana container with root permissions (user: '0'), allowing it to write to the specified directories without permission issues.