Docker: influxdb internal network usage?

Hi all,

so I installed influxdb using docker this weekend and one of the things I noticed that I don’t seem to be able to make openhab connect to the influxdb through a docker alias.

I created a network “influxdb” and added it to the influxdb container with an alias “influxdatabase”, OpenHAB is on the same network, when configuring influxdb.cfg with:

url=http://influxdatabase:8086

Openhab (and Chronograf as well) spit outs a “cannot resolve host influxdatabase” error.
As OpenHAB and Chronograf both can’t access the influxdb through the alias this is more of a docker config issue then a OpenHAB issue. Yet I know some people are running their influxdb in docker as well and was wondering how they got this configured?

Note: when I configure the host ip “192.168.1.30” and expose the influxdb port to the outside world everything works fine. Yet it should be possible to keep this in the docker backend and to keep things a bit more secure :slight_smile:

PS: I’m using a cofnfiguration with a backend network and alias for my mqtt setup and this works fine. No idea why it gives problems for influxdb

Hi,

I’m running OpenHab with Influx and Grafana on a Qnap NAS. In order to spin up my setup I do run these commands in Qnap SSH:

docker run -itd
–name=influxdb
-p 8086:8086
-v /etc/TZ:/etc/timezone:ro
-v /etc/localtime:/etc/localtime:ro
-v /share/Docker/influxdb:/var/lib/influxdb
-e INFLUXDB_DB=openhab
-e INFLUXDB_HTTP_AUTH_ENABLED=true
-e INFLUXDB_ADMIN_USER=openhab
-e INFLUXDB_ADMIN_PASSWORD=openhab
-e INFLUXDB_USER=grafana
-e INFLUXDB_USER_PASSWORD=grafana
–restart=unless-stopped
influxdb

docker run -itd
–name=openhab
–privileged
–device=/dev/ttyACM0
–net=host
-p 8101:8101
-p 9443:9443
-v /etc/TZ:/etc/timezone:ro
-v /etc/localtime:/etc/localtime:ro
-v /share/Docker/openhab/userdata:/openhab/userdata
-v /share/Docker/openhab/addons:/openhab/addons
-v /share/Docker/openhab/conf:/openhab/conf
-e APPDIR=’/openhab’
-e ARCH=‘x86_64’
-e CRYPTO_POLICY=‘limited’
-e LANG=‘en_US.UTF-8’
-e LANGUAGE=‘en_US.UTF-8’
-e LC_ALL=‘en_US.UTF-8’
-e TZ=‘Europe/Luxembourg’
-e OPENHAB_HTTP_PORT=‘9080’
-e OPENHAB_HTTPS_PORT=‘9443’
-e PATH=’/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin’
–restart=unless-stopped
openhab/openhab:2.3.0-snapshot-amd64-alpine

docker run -itd
–name=grafana
–link influxdb:influxdb
-p 3000:3000
-v /etc/TZ:/etc/timezone:ro
-v /etc/localtime:/etc/localtime:ro
-v /share/Docker/grafana:/var/lib/grafana
-e “GF_SECURITY_ADMIN_PASSWORD=admin”
-e “GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource,natel-discrete-panel”
–restart=unless-stopped
grafana/grafana

Big difference might be that I run OpenHAB with net=host (in order to fetch broadcast/multicast messages). If you do not want to run it on the machine’s network, just try the link attribute, the same way I did between grafana and influx container.

Thanks, the grafana stuff will definitely help me to setup grafana in the future :slight_smile :slight_smile:
So, I had a look at the link flag and it seems that it’s legacy and might get removed in the future so I prefer not to use it… I’ll check if I can find some assistance on the influxdb forum perhaps. To be continued!