Trouble Connecting Grafana to Influx in Dockerized Environment

I am using Grafana 10.0.3 installed as a docker running on a windows 10 docker for desktop environment. I also have an InfluxDB v2.7.1 docker running which I am trying to connect the grafana too. I am configuring the “connection” for the Influx DB in the grafana ui using the Flux Language option. My org is “MyOrg” and I created a new token with all access.

  • I have tried without any header and I have tried adding a header named “Authorization” with value as Token <###>

The error I get is Post “http://influxdb:8086/api/v2/query?org=MyOrg”: dial tcp: lookup influxdb: i/o timeout error reading buckets

This is the online url I am following: InfluxDB data source | Grafana documentation

I was expecting “success” when I clicked save and Test in the communication config for InfluxDB source

Welcome

Please post an image of your connection



Hi Yosiasz
I have tried these two scenarios plus I have tried with a url http://localhost:8086
Regards Chad


This image is from an edge device that is working with Influx and Grafana. The version of Influx is the same but Grafana on the Edge device is v9.1.0. I don’t have the server option in the newer version of Grafana? Is that because its no longer required or is there another config somewhere that enables that field? I did try the skip TLS Verify and get the same result (see below)

I have also tried with and without a bucket. I have confirmed the syntax of the bucket matches that of whats in the influx db

1 Like

that all looks good to me. can you share your docker compose file for each or docker run command

This was the run command for the influx docker.
“docker run --name InfluxDb -p 8086:8086 -e DOCKER_INFLUXDB_INIT_MODE=setup -e DOCKER_INFLUXDB_INIT_USERNAME=admin -e DOCKER_INFLUXDB_INIT_PASSWORD=adminadmin -e DOCKER_INFLUXDB_INIT_ORG=MyOrg -e DOCKER_INFLUXDB_INIT_BUCKET=Demo -e DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=XnKMylcdGcqrPefvmRd2UWziL70c5iZyvH811vhSxtZToTeDvFH8I7RvfUaHosq-aslifhmT2dTR2n4WJm7eqg== -d -v C:\DockerRepository[Influx:/var/lib/influxdb2](http://influx/var/lib/influxdb2) influxdb:2.7”

For Grafana u pulled the docker image in then opened the image from docker for desktop


are you using the above token for the grafana influx data source?

XnKMylcdGcqrPefvmRd2UWziL70c5iZyvH811vhSxtZToTeDvFH8I7RvfUaHosq-aslifhmT2dTR2n4WJm7eqg==

Yes this is what I am using for a token

create a new token with full permission to the buckets and use that new token in grafana

Created a new “All Access” token. I recieved the same error. I pulled this from the docker for desktop logger.
2023-11-24 14:18:27 logger=tsdb.influx_flux t=2023-11-24T19:18:27.151344806Z level=warn msg=“Flux query failed” err=“Post "vttp://InfluxDb:8086/api/v2/query?org=MyOrg": dial tcp: lookup InfluxDb: i/o timeout” query=buckets()
2023-11-24 14:18:27 logger=tsdb.influxdb t=2023-11-24T19:18:27.151390668Z level=warn msg=“error performing influxdb healthcheck” err=“Post "vttp://InfluxDb:8086/api/v2/query?org=MyOrg": dial tcp: lookup InfluxDb: i/o timeout”
2023-11-24 14:18:27 logger=context userId=1 orgId=1 uname=admin t=2023-11-24T19:18:27.1514558Z level=info msg=“Request Completed” method=GET path=/api/datasources/uid/a1413727-33e5-43c7-bab5-461c0911a190/health status=400 remote_addr=172.17.0.1 time_ms=10001 duration=10.00123659s size=145 referer=vttp://localhost:3001/connections/datasources/edit/a1413727-33e5-43c7-bab5-461c0911a190 handler=/api/datasources/uid/:uid/health

A bit surprised at the address containing the 17 in the second octet? Im not sure where that comes from or if that is even an issue. Is there anything in the log that jumps out at you?

p.s. I substituted the v for the h because there is some limitation of only 2 links allowed on this board…

1 Like

Odd. it could be an issue of the two containers not being able to communicate? some networking issue?

If I were you I would move forward with either installing grafana and influxdb directly in windows

or

install them both together using one docker-compose.yaml file