Change grafana.ini in docker install

I am using grafana with a basic docker installation. How can I change the grafana.ini file inside the docker to set up new logs level?

Hi,

You can use Docker volumes to map your local config file to docker file as below:

 docker run --rm --mount type=bind,source=$PWD/custom.ini,target=/etc/grafana/grafana.ini -p 3000:3000 grafana/grafana

If it’s only for a small set of settings, you can also use environment variables:

docker run --rm -e "GF_USERS_DEFAULT_THEME=light" -p 3000:3000 grafana/grafana
2 Likes

Thanks, I used this in a docker compose file and it seems to be good

hi Patwiken
i would like to do the same.
can you share me what you entered in the compose file?

You just use the config as another volume.

   volumes:
    - ./volumes/grafana/data:/var/lib/grafana
    - ./volumes/grafana/log:/var/log/grafana
    - ./volumes/grafana/config/custom.ini:/etc/grafana/grafana.ini

Here is an example of how to include environmental variables to change the Grafana configuration using docker-compose. With this solved this issue #https://github.com/grafana/grafana/issues/36929

version: '3.7'
services:
  grafana:
    image: grafana/grafana
    container_name: grafana_container
    restart: always
    ports:
      - 3000:3000
    networks:
      - monitoring_network
    volumes:
      - grafana-volume:/var/lib/grafana
    environment:
      - GF_LIVE_MAX_CONNECTIONS=0
  influxdb:
    image: influxdb:1.8.6
    container_name: influxdb_container
    restart: always
    ports:
      - 8086:8086
    networks:
      - monitoring_network
    volumes:
      - influxdb-volume:/var/lib/influxdb
networks:
  monitoring_network:
volumes:
  grafana-volume:
    external: true
  influxdb-volume:
    external: true