Sonos binding when running inside Docker container using bridged networking

Hello fellow community members,

I have the following issue that I need help with - I have the feeling that more people may have run into this as well so I’m hoping we can pool our experience and find a solution.

I’m running OpenHAB 2.3.0 inside a Docker container. This Docker container, as well as several other supporting containers are running on my custom Docker network. (e.g. ‘nodered’, ‘mqtt’, ‘influxdb’, ‘grafana’, etc). This is all working fine and without issues.

However, I would like to use the Sonos binding to control my Sonos players. Using this binding requires multicast/uPnP working on the network. I was unable to get this to work with my custom Docker network (since it doesn’t do multicast forwarding I suppose). I needed to start the OpenHAB container with ‘host’ networking enabled. This isn’t the most elegant solution and it required me to remap some ports since it conflicted with another container (my Unifi controller to be precise). It’s not the prettiest solution but now at least I could discover my Sonos devices and control them using my things/items config.

So far so good… but now I need to expose all the supporting containers (‘influxdb’ for example) as well since my OpenHAB container (now with ‘host’ networking enabled) cannot reach the influxdb container via my custom network.

TL;DR :

  • Is there anyway to get the Sonos binding to work without having to rely on ‘host’ network for the container. (what config do you use?)
  • If I do need to use ‘host’ networking for my OpenHAB container, can I somehow access my other containers without having to expose their ports to the host? (I wasn’t able to add the OpenHAB container to the host network and a custom bridge network simultaneously)

Hope someone can shed some light on this - I’ve been going over this issue for the past couple of days and haven’t been able to crack it. Many thanks in advance!

Hi there!

Do you have a solution for this problem. I have exact the same problem!

Maybe some other guy has a solution!

Did you try the docker macvlan driver?

I setup OH2.5 in a Docker Container on Qnap with Sonos binding. Qnap does not support the macvlan driver, however it has an alternative for it, the qnet driver.
With this setup the Sonos device was correctly discovered. I could mute the device with a switch item, but the state of the items where not correctly updated. It seems that the communication from the Sonos device OH did not work.

I can share for the docker-compose.yml file.

I use docker with the net=host option on my NUC/Debian and my sonos devices are not found. Something is fishy with sonos in docker…have to investigate this further.

I tried also the net=host options on my Qnap. The Sonos-device was also not found, but with the qnet (alternative to macvlan) driver it was discovered.