Comments (15)
Added some notes to the README. Thanks for bringing up the issue, I had never encountered it!
from gateway-docker.
Cool, yes it works. Didn't know I had to add the "Web Thing" add-on I thought this is native.
from gateway-docker.
Great! I'm rebuilding the Docker images and will push to Docker Hub shortly.
from gateway-docker.
It seems like the gateway Docker image is unable to do mDNS resolution on your network. Are you running your container in host networking mode? I'm guessing we need to add avahi-daemon
libnss-mdns
to the Docker image, but that seems to be... complicated.
See: https://stackoverflow.com/questions/30646943/how-to-avahi-browse-from-a-docker-container
from gateway-docker.
Ohh.. It seems to be on that side.. Evidently, the gateway docker discovers it, but cannot access it..
Executing the command inside the container (I should have tried it before 😅 ) fail.
[matias@nube ~]$ sudo docker exec -it 41db43129204 curl -i -H "Accept: application/json" "http://ac-controller.local:80"
curl: (6) Could not resolve host: ac-controller.local
But if I use the ip it works.. 😃
[matias@nube ~]$ sudo docker exec -it 41db43129204 curl -i -H "Accept: application/json" "http://192.168.1.246:80"
HTTP/1.1 200 OK
Content-Length: 872
Content-Type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: PUT, GET, OPTIONS
Connection: close
Accept-Ranges: none
[{"id":"ac","title":"Air Conditioning Controller","@context":"https://iot.mozilla.org/schemas","securityDefinitions":{"nosec_sc":{"scheme":"nosec"}},"@type":["OnOffSwitch"],"links":[{"rel":"properties","href":"/things/ac/properties"},{"rel":"events","href":"/things/ac/events"},{"rel":"alternate","href":"ws://192.168.1.246:80/things/ac"}],"properties":{"ambientHum":{"type":"number","readOnly":true,"unit":"%","@type":"AmbientHumProperty","links":[{"href":"/things/ac/properties/ambientHum"}]},"ambientTemp":{"type":"number","readOnly":true,"unit":"°C","@type":"AmbientTempProperty","links":[{"href":"/things/ac/properties/ambientTemp"}]},"setTemp":{"type":"number","unit":"°C","@type":"TempProperty","links":[{"href":"/things/ac/properties/setTemp"}]},"on":{"type":"boolean","@type":"OnOffProperty","links":[{"href":"/things/ac/properties/on"}]}},"href":"/things/ac"}
Thanks @mrstegeman ,
I guess you can close it, and open it in the docker repository.
from gateway-docker.
Sorry..
Are you running your container in host networking mode?
You mean this?
So, yes. In these test I am using:
sudo docker run -d --rm -v /usr/share/mozilla-iot:/home/node/.mozilla-iot --net=host --name mozilla-iot-gateway mozillaiot/gateway:latest
from gateway-docker.
I've been playing around, and here's what I've discovered:
- nss-mdns (the mDNS resolution library) only works with avahi-daemon running.
- avahi-daemon has a hard dependency on dbus.
- dbus doesn't really work inside a Docker container.
- You can share in the dbus socket from the host, or use the running avahi-daemon instance from the host, but that's pretty terrible for users.
- We could get around all of this by using IP addresses, rather than
<hostname>.local
, in thing-url-adapter. However, that falls apart if the host is then assigned a new IP address via DHCP. - Sticking with IP addresses in the config is probably the best workaround for this issue.
from gateway-docker.
Hi,
Sticking with IP addresses in the config is probably the best workaround for this issue.
Well, I guess it's acceptable as an optional configuration.. Disabled by default, and documented in this repo to use when necessary.
However, that falls apart if the host is then assigned a new IP address via DHCP.
I insist on the optional for this reason, since it is a problem of this implementation, and most of the potential users will not implement the gateway using docker.
Thanks for investigating.
from gateway-docker.
I have the gateway running in docker on an olimex board running armbian (https://www.armbian.com/olimex-lime-2/). I additionally had to install libnss-mdns (which also depends on avahi-daemon). So far about my environment.
Can anybody explain, how to mount the avahi daemon into the docker environment? Where is the socket usually running, and where does the gateway docker expect it? Maybe this could also be added to the README as well.
from gateway-docker.
I found the socket under /var/run/avahi-daemon/socket
on the host but just mounting it to the smae path /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket
did not do the trick.
from gateway-docker.
I don't think the avahi socket is the problem, it's the lack of dbus.
from gateway-docker.
What about running a dbus inside the docker image: https://stackoverflow.com/a/45274624/414075
Or use it like this: https://github.com/mviereck/x11docker/wiki/How-to-connect-container-to-DBus-from-host
from gateway-docker.
The second one is probably preferable, if you can get it to work. I've tried running dbus inside containers in the past and have had very bad luck. Please let me know if you get a solution working, though!
from gateway-docker.
With my pull request the libnss-mdns and avahi-daemon is included. The avahi-daemon can be started with enable-dbus=no
in the configuration.
When I enter the container with docker exec -it … /bin/bash
I can ping my .local devices which was not possible before.
But somehow the WebThings gateway does only do "Scanning for new devices... " but does not find the single-thing (https://github.com/mozilla-iot/webthing-python/blob/master/example/single-thing.py) that is running on the computer that can be pinged using its hostename.local from within the container.
from gateway-docker.
This is fantastic! I'm able to find and add devices just fine now.
Questions:
- Do you have the "Web Thing" add-on installed?
- Are you able to add that host by using the "Add by URL" feature?
from gateway-docker.
Related Issues (20)
- ZigBee USB Device HOT 10
- Raspberry Pi reboots when trying to pull the image HOT 5
- CODE_OF_CONDUCT.md file missing
- Permission errors with volumes created by `docker volume` HOT 1
- LICENSE file is missing
- [Feature Request] Automated build and push for dockerfiles to dockerhub HOT 2
- WebPack produces 100% CPU utilization on RPi2 on container start HOT 1
- Failed to generate certificate HOT 1
- Great! I'm rebuilding the Docker images and will push to Docker Hub shortly. HOT 1
- Avahi - daemon already running HOT 8
- Use docker-compose and a well-known Avahi image HOT 1
- Synology Gui walkthrough HOT 1
- Clarification of Readme
- GPIO Pins HOT 2
- Consider adding support to ARMv6 boards HOT 4
- Changing the Moz://a dashboard interface. HOT 2
- Cannot run arduino CLI in container on Pi 4b HOT 3
- How to configure proxy for adding ZigBee add-on ? HOT 1
- Developing addon requires container restart on every code change HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gateway-docker.