Enable flux query with docker compose

Hi Team,

I’m new to InfluxDB2 and using a docker-compose to up and run grafana and InfluxDB2 containers

influxdb2:
image: influxdb:alpine
container_name: influxdb2local
networks:
- PERF_Network
ports:
- “8086:8086”
environment:
- INFLUXDB_HTTP_FLUX_ENABLED=‘true’
- DOCKER_INFLUXDB_INIT_MODE=setup
- DOCKER_INFLUXDB_INIT_USERNAME=myusername
- DOCKER_INFLUXDB_INIT_PASSWORD=passwordpassword
- DOCKER_INFLUXDB_INIT_ORG=k6io
- DOCKER_INFLUXDB_INIT_BUCKET=k6
- DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=mytoken

my data source looks like this

apiVersion: 1

datasources:
name: InfluxDB2_Provisioning
type: influxdb
url: http://influxdb:8086
isDefault: true
secureJsonData:
token: mytoken
jsonData:
version: Flux
organization: k6io
defaultBucket: k6

When I try to test the data source connection, I get the below error message.

403 Forbidden: Flux query service disabled. Verify flux-enabled=true in the [http] section of the InfluxDB config. error reading buckets

guide me on how to handle it through docker-compose or any other way.

How are you trying to test the data source connection?

The following blog might be helpful:

Hi @Anaisdg,
Still facing the same issue after updating the configuration. Grafana Datasource set through the YAML file. Please find below.

apiVersion: 1

datasources:
name: InfluxDB2_Provisioning
type: influxdb
url: http://influxdb:8086
isDefault: true
secureJsonData:
token: mytoken
jsonData:
version: Flux
organization: k6io
defaultBucket: k6

InfluxDB is up and running but when I try to integrate with Grafana, it shows an error message.
image

The InfluxDB docker inspect shows the below output for the ENV section

“Env”: [
“DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=mytoken”,
“DOCKER_INFLUXDB_HTTP_FLUX_ENABLED=true”,
“DOCKER_INFLUXDB_INIT_MODE=setup”,
“DOCKER_INFLUXDB_INIT_USERNAME=croco”,
“DOCKER_INFLUXDB_INIT_PASSWORD=passwordpassword”,
“DOCKER_INFLUXDB_INIT_ORG=k6io”,
“DOCKER_INFLUXDB_INIT_BUCKET=k6”,
“PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”,
“GOSU_VER=1.12”,
“INFLUXDB_VERSION=2.7.0”,
“INFLUX_CLI_VERSION=2.7.1”,
“INFLUX_CONFIGS_PATH=/etc/influxdb2/influx-configs”,
“INFLUXD_INIT_PORT=9999”,
“INFLUXD_INIT_PING_ATTEMPTS=600”,
“DOCKER_INFLUXDB_INIT_CLI_CONFIG_NAME=default”
],

If the issue is due to the privilege issue, guide me on how to generate and set the admin token values on the docker-compose as well as provisioning the YAML file.

guide me to resolve the problem.

Datasource misconfiguration.