The InfluxDB API is running fine:
$ curl -sl -I http://myserver:8086/ping
HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: 6e88a0a0-5288-11e8-a203-000000000000
X-Influxdb-Build: OSS
X-Influxdb-Version: 1.5.2
X-Request-Id: 6e88a0a0-5288-11e8-a203-000000000000
Date: Tue, 08 May 2018 06:24:15 GMT
But I cannot add InfluxDB as datasource, it keep saying “Network Error: Bad Gateway(502)” when I click “Save & Test”
I leave Auth option blank as by default InfluxDB disables authorization (should it be turned on?)
Btw, I’m using docker to run grafana and influxdb:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
10a1f272e16b grafana/grafana "/run.sh" 4 hours ago Up 4 hours 0.0.0.0:3001->3000/tcp grafana_grafana_1
cc277600039a timescale/pg_prometheus:master "docker-entrypoint.s…" 19 hours ago Up 19 hours 0.0.0.0:5432->5432/tcp timescale_timescale_1
9284ef465c2c chrono_config "/entrypoint.sh chro…" 22 hours ago Up 22 hours 0.0.0.0:8888->8888/tcp sandbox_chronograf_1
12ce9dacff2b telegraf:latest "/entrypoint.sh tele…" 22 hours ago Up 22 hours 8092/udp, 8125/udp, 8094/tcp sandbox_telegraf_1
dc1a8df2e3a4 ifqld_wait "./wait_for_influxdb…" 22 hours ago Up 22 hours 0.0.0.0:8093->8093/tcp sandbox_ifql_1
d0e77fb58886 kapacitor:latest "/entrypoint.sh kapa…" 22 hours ago Up 22 hours 0.0.0.0:9092->9092/tcp sandbox_kapacitor_1
2c879ce595d8 sandbox_documentation "/documentation/docu…" 22 hours ago Up 22 hours 0.0.0.0:3010->3000/tcp sandbox_documentation_1
cb1b97db24a5 influxdb:latest "/entrypoint.sh infl…" 22 hours ago Up 22 hours 0.0.0.0:8082->8082/tcp, 0.0.0.0:8086->8086/tcp, 0.0.0.0:8089->8089/tcp sandbox_influxdb_1
You should create docker network where grafana and influxdb will be able to reach other.
Or publish app port and use host IP. Or start containers in host mode. Anyway docker networking doc will be good start point for you to understand pros/cons of all options.