UPDATE: Stupid, stupid mistake. I had set server
(the name in the interface), not proxy
as the value of access
in datasources.yaml
. The good news is: it works perfectly now
My goal is to connect Grafana to Influx DB in a Docker network kwenv_default
. The InfluxDB has container name and port kwenv_influxdb_1:8086
. Iāve verified that it is accessible on the network at that name by writing to it from a node-red container.
PROBLEM: In Datasource, I cannot connect Grafana to InfluxDB via kwenv_influxdb_1:8086
. āSave & Testā reports that the data source is working in Server access mode for that address. But dashboards display no data and a red exclamation mark. The Query Inspector returns āIf youāre seeing this Grafana has failed to load its application filesā.
I can connect by exposing InfluxDBās ports to the host and hardcoding the host machine IP in Grafanaās datasource URL. But I donāt want InfluxDB accessible from the host, and I donāt want to have to configure the URL manually every install.
Can you advise why Grafana is unable to load its application files using a Docker container name and network, and how to configure it to do so?
docker-compose
version: '3.7'
services:
influxdb:
image: influxdb:1.7-alpine
ports:
- 8086:8086
environment:
- INFLUXDB_HTTP_AUTH_ENABLED=${INFLUXDB_HTTP_AUTH_ENABLED}
- INFLUXDB_ADMIN_USER=${INFLUXDB_ADMIN_USER}
- INFLUXDB_ADMIN_PASSWORD=${INFLUXDB_ADMIN_PASSWORD}
- INFLUXDB_DB=${INFLUXDB_DB}
- INFLUXDB_USER=${INFLUXDB_USER}
- INFLUXDB_PASSWORD=${INFLUXDB_PASSWORD}
volumes:
- ./influxdb/:/var/lib/influxdb
- ./influxdb/influxdb.config:/etc/influxdb/influxdb.conf:ro
grafana:
image: grafana/grafana:latest
depends_on:
- influxdb
ports:
- 3000:3000
environment:
- GF_SECURITY_ADMIN_USER=${GF_SECURITY_ADMIN_USER}
- GF_SECURITY_ADMIN_PASSWORD=${GF_SECURITY_ADMIN_PASSWORD}
volumes:
- ./grafana:/var/lib/grafana
- ./grafana/provisioning:/etc/grafana/provisioning
datasources.yaml
apiVersion: 1
datasources:
- name: InfluxDB
type: influxdb
access: server
url: kwenv_influxdb_1:8086
isDefault: true
basicAuth: true
basicAuthPassword: true
basicAuthUser: admin
secureJsonData:
basicAuthPassword: [REDACTED]
database: nodered_db
editable: true
Thank you.