0

I know there are some similar questions in the forum, but nothing worked really out. I try to connect grafana and influxdb with a dockercompose File, but everytime i get a Bad Gateway error. Here is the file:

services:
  grafana:
    image: grafana/grafana
    container_name: grafana
    restart: always
    ports:
      - 3000:3000
    networks:
      - grafana_network
    volumes:
      - grafana_data:/var/lib/grafana
    depends_on:
      - influxdb


  influxdb:
    image: influxdb:latest
    container_name: influxdb
    restart: always
    ports:
      - 8086:8086
    networks:
      - grafana_network
    volumes:
      - influxdb_data:/var/lib/influxdb
    environment:
      - INFLUXDB_DB=grafana
      - INFLUXDB_USER=grafana
      - INFLUXDB_USER_PASSWORD=password
      - INFLUXDB_ADMIN_ENABLED=true
      - INFLUXDB_ADMIN_USER=admin 
      - INFLUXDB_ADMIN_PASSWORD=password 
networks:
  grafana_network:
volumes:
  grafana_data:
  influxdb_data:

Bad Gateway Error

I already changed influxdb to localhost or ipaddress, nothing helped Only the Error changed to Bad Request.. Any recommendations?

Big Thanks!

danberg13
  • 3
  • 2
  • Welcome to SO. Please add link to the other posts you saw. Also consider explaining why they did not work/apply to your case. – Homero Esmeraldo Apr 23 '21 at 21:47
  • https://stackoverflow.com/questions/65050546/influxdb-in-docker-bad-gateway here is for example a similar question. 1. I tried to change from localhost to influxdb or my ipaddress but nothing worked. 2. volumes section is in my dockerfile, Maybe you have some other ideas? Thanks! – danberg13 Apr 25 '21 at 08:46

1 Answers1

1

Had the same problem.

Selecting the Query Language Flux instead of InfluxQL worked for me.

Don't forget to use the URL http://influxdb:8086 as this is the name of your InfluxDB-service within docker compose.

  • Thanks for the solution! I think Flux works for Influxdb OSS 2.0. In my case changing the image to an older version worked out: `image: influxdb:1.8-alpine and image: grafana/grafana:7.5.4` in the docker-compose file solved the problem. – danberg13 May 07 '21 at 14:22