I am admittedly a little out of my depth here, so I will try and explain as much as I can and then give a tl;dr at the bottom.
I am trying to run a python script that utilises the ouimeaux library. This is a library that scans and interfaces (using multicast) with Wemo devices on the LAN. Wemo devices are a range of IoT devices that do lots of things, however, the one I own allows me to remotely turn on/off devices over the internet and monitor the device’s power usage.
My script is interfacing with telegraf using the input.exec (I.E. “Run a command on the system and parse the stdout”).
Everything thus-far works perfectly outside of the container. The issue I’m having is that when I place this inside the container, if I use:
--network host
The python script works fine, however telegraf tells me it is unable to connect to the influxdb database it is logging to (Also containerized, on a custom bridge named “network_influxdb”). This is expected.
If I use:
--network network_influxdb
The python script is unable to locate any Wemo devices on my network, however telegraf works fine and can connect to the influxdb.
Logic should hold that I should be able to run:
--network host --network network_influxdb
and be able to both submit multicast packets to the host network, and directly connect to the influxdb database via Docker. This is where issues arrise, the python script works amazingly (Dumping the electrical usage of all my Wemo switches), however, the telegraf container is no longer able to address the influxdb container by its container name, influxdb
:
# ping influxdb
ping: unknown host influxdb
However, I can connect to it via its bridge interface’s IP:
# curl 172.19.0.3:8086 -vvvvv
* Rebuilt URL to: 172.19.0.3:8086/
* Hostname was NOT found in DNS cache
* Trying 172.19.0.3...
* Connected to 172.19.0.3 (172.19.0.3) port 8086 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 172.19.0.3:8086
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
< X-Influxdb-Version: 1.1.1
< Date: Mon, 16 Jan 2017 20:36:50 GMT
< Content-Length: 19
<
404 page not found
The end solution would be any of the following (In order of most preferred to least preferred, however, I don’t 100% understand multicast, so, I may be talking crazy):
- “port-forward” multicast from host to docker container, so that the container doesn’t have to run on the host network but can still talk multicast to the host’s LAN
- Get the DNS resolver to work despite the container being both on the host’s network and the bridge network
- Something else that’d resolve my issue?
Thanks for your time,
dfy.
tl;dr:
Multicast isn’t working from docker container to host LAN, when running --network host --network dockerbridge
the DNS resolver for other containers on the bridge no longer works. What should I do?