Reputation: 121
I am trying to setup grafana on docker using a custom grafana.ini file, however grafana is not picking up my config, I am using the command below
docker run -d -p 3000:3000 \
-v /opt/pf-grafana:/opt/pf-grafana \
grafana/grafana \
--config=/opt/pf-grafana/grafana.ini
I also verified that the grafana.ini file is correctly formatted. What am I missing?
Contents of /opt/pf-grafana folder (ls from the container)
Upvotes: 4
Views: 13105
Reputation: 121
I finally got it working, the solution was to use environment variables, the "-e" flag overrides the default settings. The AUTH_LDAP_ENABLED and AUTH_LDAP_CONFIG_FILE are the settings in the default grafana.ini file. Note, they need to be specified in CAPS and separated by "_"
Below snippet worked for me
docker run -d -p 3000:3000 -v /opt/pf-grafana:/opt/pf-grafana \
-e "GF_AUTH_LDAP_ENABLED=true" \
-e "GF_AUTH_LDAP_CONFIG_FILE=/opt/pf-grafana/ldap.toml" \
grafana/grafana
Upvotes: 6
Reputation: 6458
Try this:
docker run -d -p 3000:3000 \
-v /opt/pf-grafana:/opt/pf-grafana \
-v /opt/pf-grafana/grafana.ini:/etc/grafana/grafana.ini \
grafana/grafana
The reason:
You can't actually override the --config
argument since it was supressed by the previous defined --config
in run.sh
(the entrypoint of grafana/grafana
). However, by replacing the default config file /etc/grafana/grafana.ini
will allow you to use your own configuration instead of the default one.
Upvotes: 2