jishi / node-sonos-discovery

Simplified framework for Sonos built on node.js
MIT License
146 stars 75 forks source link

No devices found from Docker #27

Closed jasperla closed 9 years ago

jasperla commented 9 years ago

When running sonos-web-controller from a Docker container it fails to find any devices. When I run it outside of a container it picks up all the Sonos devices just fine.

Here is the netstat output from within the container:

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:3500            0.0.0.0:*               LISTEN      123/node
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      123/node
udp        0      0 172.17.0.20:1901        0.0.0.0:*                           123/node

Note that 172.17.0.20 is the local non-public IP address of the container, and it just stays listening on 1901. Whereas my other Linux machine listens on 192.168.178.156:1901/udp for a little bit, finds all devices and moves on.

I've started my container with -p 8080:8080 -p 3500:3500 -p 1901:1901/udp to ensure that everything goes through. However it seems I'm still missing something. Any clues will be much appreciated.

jishi commented 9 years ago

Hi. Upnp isn't designed to work over different subnets, because it make use of multicasting. I'm pretty sure that's the reason for it not finding any players.

Unless you can make docker forward multicasting packets, it won't work without bridging docker into the same network as your sonos system somehow. I'm not that familiar with docker I'm afraid, so I don't know which options you have. On Feb 20, 2015 10:24 PM, "Jasper Lievisse Adriaanse" < notifications@github.com> wrote:

When running sonos-web-controller from a Docker container it fails to find any devices. When I run it outside of a container it picks up all the Sonos devices just fine.

Here is the netstat output from within the container:

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:3500 0.0.0.0:* LISTEN 123/node tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 123/node udp 0 0 172.17.0.20:1901 0.0.0.0:* 123/node

Note that 172.17.0.20 is the local non-public IP address of the container, and it just stays listening on 1901. Whereas my other Linux machine listens on 192.168.178.156:1901/udp for a little bit, finds all devices and moves on.

I've started my container with -p 8080:8080 -p 3500:3500 -p 1901:1901/udp to ensure that everything goes through. However it seems I'm still missing something. Any clues will be much appreciated.

— Reply to this email directly or view it on GitHub https://github.com/jishi/node-sonos-discovery/issues/27.

jasperla commented 9 years ago

Hi, thanks for your quick reply. I managed to get it working once I realised that upnp won't work between subnets. So for future reference, I ran the container with --net=host and opened port 8080/tcp, 3500/tcp and 1901/udp (in the host firewall) and then it just worked :)