dockergrafanainfluxdbdocker-for-windows

Problems setting up a docker based InfluxDB/Grafana network


My intention is to use Windows Docker to deploy an InfluxDB 2.0.8 database and link to it via a self-hosted Grafana instance on the same docker network.

To do so, I've done the below steps:

  1. Start the network, InfluxDB and Grafana via below:
docker network create influxdb
docker run -d --net=influxdb --name=grafana -p 3000:3000 grafana/grafana
docker run -d --net=influxdb --name=influxdb -p 8086:8086 --volume C:/influxdb:/var/lib/influxdb2 influxdb:2.0.8
  1. Open http://localhost:8086 to set up the basics. Via the InfluxDB UI get the below details:
  1. I then go to Grafana via localhost:3000 and add an InfluxDB data storage (Flux) and enter the above details. However, when I test it, I get an "Error reading InfluxDB". In the console, I get the below error:
POST http://localhost:3000/api/ds/query 400 (Bad Request)
{refId: 'test', message: 'Post "http://localhost:8086/api/v2/query?org=35e0f…l tcp 127.0.0.1:8086: connect: connection refused'}

Any idea what might be missing in the above?


Solution

  • I think another way to access influx from grafana would be accessing it from container name: setup influxdb data source as: influxdb:8086