adkop
adkop

Reputation: 184

Grafana Config - Docker Compose

I want to run a grafana instance with custom configuration and docker compose, but I face permission issues with it.

My config is in: ./grafana/config/grafana.ini

When I try to run the image with docker compose, I get an error

logger=settings t=2023-12-21T21:19:12.374400182Z level=error msg="failed to parse "/etc/grafana-config/grafana.ini": open /etc/grafana-config/grafana.ini: permission denied"

version: "3"
services:

  grafana:
    image: grafana/grafana:latest
    entrypoint:
      - /usr/share/grafana/bin/grafana-server
      - --homepath=/usr/share/grafana
      - --config=/etc/grafana-config/grafana.ini
    volumes:
      - ./grafana/config/grafana.ini:/etc/grafana-config/grafana.ini
    ports:
      - "3000:3000"

Thank you for your help!

Upvotes: 0

Views: 600

Answers (1)

adkop
adkop

Reputation: 184

So the error is because of SELinux on Red Hat based distros or AppArmor on Debian based distros. Thus, I use Red Hat I will only describe here the solution to SELinux.

First, you can check if SELinux is the problem by disabling it: setenforce 0

If you now can add not named volumes to docker, you successfully located the problem. Now you can disable it for a docker container, just add this argument: --security-opt label:disable

You can also just disable SELinux just for some directories for that I have linked the source where you can check out some deeper explanations and examples.

Credits: Datadog

Upvotes: 0

Related Questions