Using soco from within a docker container ?

189 views
Skip to first unread message

Max Rydahl Andersen

unread,
Oct 7, 2018, 4:06:30 AM10/7/18
to SoCo - Sonos Controller
Hi,

Anyone succeeded to get soco to discover or even just interact with sonos from within a docker container ?

I tried running with —net=host but it does not seem to make a difference.

Any pointers welcome!

Max Rydahl Andersen

unread,
Oct 10, 2018, 4:36:08 PM10/10/18
to SoCo - Sonos Controller
in case anyone finds this here is what i figured out:

the trick is to run the sonos container in --net=host mode. This at the moment only works on native docker hosts (such as Linux) and thus does not work on Docker for Mac.

If you are using docker compose you can run soco based apps the following way:

sonos:
tty: true
stdin_open: true
expose:
- 1915
ports:
- 1915:1915
image: maxandersen/sonos_exporter
command:
- '--address=0.0.0.0:1915'
network_mode: host

the main trick is network_mode: host

AND to bind to not just localhost but 0.0.0.0 or the direct ip as otherwise your app won't be properly exposed.

the rest are just example values (in this case for running a prometheus sonos exporter)

/max
Reply all
Reply to author
Forward
0 new messages