frdmn / docker-speedtest-grafana

🚢📦Grafana + InfluxDB + Speedtest.net results
MIT License
207 stars 71 forks source link

502 error 53: connect: cannot assign requested address #24

Open jeanfrancoislarente opened 3 years ago

jeanfrancoislarente commented 3 years ago

Trying to use the docker-compose file as-is and the error I'm getting in the grafana container logs is:

grafana_1    | t=2021-03-01T19:06:09+0000 lvl=info msg="Request Completed" logger=context userId=0 orgId=1 uname= method=GET path=/api/datasources/proxy/1/query status=502 remote_addr=192.168.2.144 time_ms=1 size=0 referer="http://192.168.2.168:3020/d/0A6hxROiz/speedtest-results?orgId=1"

192.168.2.168 is my "docker machine" and 192.168.2.144 is my windows client which is accessing grafana via http://192.168.2.168:3020 (3020 is the port I specified for grafana)

Env file (not much changed)

GRAFANA_PORT=3020
SPEEDTEST_SPEEDTEST_INTERVAL=3600
SPEEDTEST_HOST=local

docker-compose file , should be same as master branch

version: '2'

services:
  influxdb:
    restart: always
    image: influxdb:1.8
    ports:
      - "8086:8086"
    volumes:
      - "./data/influxdb/:/var/lib/influxdb"
    environment:
      - "INFLUXDB_ADMIN_USER=admin"
      - "INFLUXDB_ADMIN_PASSWORD=password"
      - "INFLUXDB_DB=speedtest"

  grafana:
    restart: always
    image: grafana/grafana:6.7.2
    volumes:
      - "./docker/grafana/provisioning:/etc/grafana/provisioning"
    ports:
      - "${GRAFANA_PORT}:3000"
    environment:
      - "GF_SERVER_ROOT_URL=http://localhost"
      - "GF_SECURITY_ADMIN_PASSWORD=admin"
      - "GF_AUTH_ANONYMOUS_ENABLED=true"
    depends_on:
      - influxdb

  speedtest:
    restart: always
    image: frdmn/speedtest-grafana:latest
    container_name: speedtest
    environment:
      - "SPEEDTEST_INTERVAL=${SPEEDTEST_SPEEDTEST_INTERVAL}"
      - "SPEEDTEST_HOST=${SPEEDTEST_HOST}"
    depends_on:
      - influxdb
jeanfrancoislarente commented 3 years ago

So I figured out that the issue was that grafana can't resolve influxdb, so I went into the docker\grafana\provisioning\datasources\influxdb.yml file and updated the url to be the IP address.

I'd love some insight (if you have any) on why my grafana container can't resolve.

jeanfrancoislarente commented 3 years ago

I get "permission denied" when I attach to container and run cat /etc/resolv.conf