Not able to mount the directory /usr/share/grafana in grafana container

I am using Grafana 9.0.5 docker container. I have mounted the default.ini file using ./usr/share/grafana/conf/defaults.ini:/usr/share/grafana/conf/defaults.ini and it’s working fine properly. I am able to make a change in defaults.ini and it reflecting in Grafana.

Now, I want to change the UI of the Grafana login page using this blog Grafana 103: Customizing Login Screen for Grafana ! Playing with white- labels and many more .. | by Mohit Shrestha | Medium and to make the change I need the files inside the public folder which reside in /usr/share/grafana.

When I am trying to mount /usr/share/grafana/:/usr/share/grafana and by mounting this folder I can make changes in defaults.ini as well. But as soon as I mount this folder it starts giving errors.

/run.sh: line 80: exec: grafana-server: not found
/run.sh: line 80: exec: grafana-server: not found
/run.sh: line 80: exec: grafana-server: not found
/run.sh: line 80: exec: grafana-server: not found

I tried mounting both locations that are default.ini and /usr/share/grafana/ but still, it gives the same error.

This is my docker-compose file.

version: "3"
services:
  grafana:
    image: grafana/grafana:9.0.4
    container_name: grafana
    restart: always
    ports:
      - 3000:3000
    networks:
      - analytics
    volumes:
      - grafana-storage:/var/lib/grafana
      - ./usr/share/grafana/conf/defaults.ini:/usr/share/grafana/conf/defaults.ini
    environment:
      - GF_SECURITY_ADMIN_USER=username
      - GF_SECURITY_ADMIN_PASSWORD=password
  influxdb:
    image: quay.io/influxdb/influxdb:v2.0.4
    container_name: influxdb
    restart: always
    ports:
      - 8086:8086
    networks:
      - analytics
    volumes:
      - /mnt/db/:/mnt/db/
      - /mnt/influx/:/mnt/influx/
      - ./etc/influxdb/:/etc/influxdb/
      - ./etc/influxdb/:/root/.influxdbv2/
        # command: sh /etc/influxdb/historical_data_flux_queries/temp.sh
networks:
  analytics:
volumes:
  grafana-storage:

I am not sure where I am making the mistake. How can I mount the whole folder location so I can make the changes inside the /use/share/grafana folder

@gautamravikant6 Modifying configuration files directly is not a recommended way for Docker containers. Please take a look at Configure Docker image | Grafana documentation to use environment variables instead.

Many things have changed since the mentioned article was published 2 years ago. Take a look at the topic How to Customize Grafana interface, which was answered recently.

1 Like