Anton
Anton

Reputation: 309

Grafana fails to run from Docker

I'm trying to run Grafana with Prometheus using docker compose.

However I keep getting the following error from Graphana container:

service init failed: html/template: pattern matches no files: /usr/share/grafana/public/emails/*.html, emails/*.txt

Here's the content of docker-compose.yml:

version: "3.3"

volumes:
    prometheus_data: {}
    grafana_data: {}

services:
        prometheus:
                image: prom/prometheus:latest
                ports:
                        - "9090:9090"
                expose:
                        - 9090
                volumes:
                        - ./infrastructure/config/prometheus/:/etc/prometheus/
                        - prometheus_data:/prometheus
                command:
                        - '--config.file=/etc/prometheus/prometheus.yml'
                        - '--storage.tsdb.retention.time=1y'

        graphana:
                image: grafana/grafana:latest
                user: '472'
                volumes:
                        - grafana_data:/var/lib/grafana
                        - ./infrastructure/config/grafana/grafana.ini:/etc/grafana/grafana.ini
                        - ./infrastructure/config/grafana/datasource.yml:/etc/grafana/provisioning/datasources/datasource.yml
                ports:
                        - 3000:3000
                links:
                        - prometheus

As for the content of grafana.ini and datasource.yml files I'm using the default Grafana configuration files that are provided in its official Github repository.

The answer here suggests that it can be resolved by setting the correct permissions to grafana config folder. However, I tried giving full permission (with chmod -R 777 command) to the ./infrastructure/config/grafana folder and it didn't resolve the issue.

If anyone can provide any help on how to solve this problem it'd be greatly appreciated!

Upvotes: 2

Views: 1465

Answers (1)

Rami Mohamed
Rami Mohamed

Reputation: 11

USE THIS in your docker_compose

grafana:
    hostname: 'grafana'
    image: grafana/grafana:latest
    restart: always
    tmpfs:
      - /run
    volumes:
      - grafana_data:/var/lib/grafana
      - ./infrastructure/config/grafana/grafana.ini:/etc/grafana  /grafana.ini
      - ./infrastructure/config/grafana/datasource.yml:/etc/grafana/provisioning/datasources/datasource.yml
    ports:
      - "3000:3000"

Upvotes: 1

Related Questions