Hi there! I recently started using Grafana and I’m not exactly a pro when it comes to HTTP based services so hopefully this will be an easy question to answer.
My setup is like this. I have a single Docker container, within which runs InfluxDB on *:8086
and Grafana on *:3000
. Both of these ports are exposed to the host with the docker run
options -p 3000:3000 -p 8086:8086
. Grafana is configured to use the InfluxDB source with the following provisioning file:
apiVersion: 1
datasources:
- name: InfluxDB
type: influxdb
isDefault: true
database: mydb
url: http://localhost:8086
jsonData:
httpMode: GET
Since I haven’t changed the access mode here, it defaults to “Server”. Having read the Grafana docs, my understanding is that this setting causes the Grafana server - which is running in the same container as InfluxDB - to perform the request to localhost:8086
. In other words, the request should be routed completely within / local to the container. However, when I test this by running the Docker container on one machine and accessing Grafana from a different machine, this doesn’t work. I notice that if I spin up an InfluxDB on the browser machine, that Grafana will then connect to that local instance. Based on my understanding, this is the behavior I expect from “Browser”. Now, back in the container, if I change the url
in the provisioning file to the hostname of the docker host, then when I hit Grafana from my other machine, it connects just fine (as would be expected from the “Browser” setting).
What am I not understanding here?