mikebrady / shairport-sync

AirPlay and AirPlay 2 audio player
Other
7.3k stars 574 forks source link

Configuration tip: run Docker container on Linux using host dbus and avahi-daemon #1387

Closed robcast closed 2 years ago

robcast commented 2 years ago

Not a bug report but a suggestion for an optional configuration for the current s6-based unstable-development Docker container to avoid starting additional instances of dbus and avahi-daemon in the container and use the host's dbus connection instead.

  1. create an empty file down

  2. create a docker-compose.override.yml:

    
    version: "2.1"

services: shairport-sync: environment:

This configuration inhibits the dbus and avahi daemons from starting and uses the hosts system dbus instead.

I don't know if this is useful for many people and if it should be added to the documentation somewhere. Maybe an advanced configuration tips section? I created this config to control the avahi-daemon on the host to suppress network-wide announcements for shairplay-sync on the internal Docker network interface ;-)

mikebrady commented 2 years ago

Thanks for this. It might take a little while to digest!

charlesomer commented 2 years ago

Hi, I think I've been able to replicate this but it looks like whilst it's possible to connect, it's not fully functional even though /run/dbus/system_bus_socket is shared between the host and the container. Did you have the same messages appear?

         0.019426354 "dbus-service.c:1057" *warning: could not acquire a Shairport Sync native D-Bus interface "org.gnome.ShairportSync.i789" on the system bus.
         0.001928958 "mpris-service.c:348" *warning: could not acquire an MPRIS interface named "org.mpris.MediaPlayer2.ShairportSync.i789" on the system bus.
robcast commented 2 years ago

@charlesomer I do see the same messages in my shairport-sync log but it works. I can connect to shairplay-sync in the network and I see "AirTunes Remote Audio" entries with avahi-browse -art.

I had some issues when I was playing around with this setup. The host avahi-daemon stopped to work and I had to reboot to get it to work again but after that it "works for me" :-)

Maybe I should add that I run shairport-sync on a headless Linux server (ODROID-XU4, like Raspberry-Pi) without desktop environment, so I wasn't worried about something-gnome not working ;-)

charlesomer commented 2 years ago

Hmm, interesting. I think it’s best to leave this for now since I’m not sure how stable it would be etc.

robcast commented 2 years ago

I'll close this ticket as the exact solution doesn't work with the current config based on the new version of s6-overlay.

I have an updated config for my use. Re-open if you are interested ;-)