Expose avahi socket to containers

If the /var/run/avahi-daemon/socket could be exposed to containers, one could easily do somename.local lookups from within a container by simply installing the libnss-mdns package.

Would simplify my CUPS container a lot

Even being able to expose services via avahi would be really useful too - so people can create their own discovery tools etc

Thanks for the request and interest all!

We’re going to discuss internally how we might implement this. In the meantime, there is a workaround which we’ll share below:

It should be possible to announce a server or service on the hostOS avahi using avahi-publish first you need to install avahi-publish, on debian it can be done like so:

RUN apt-get update && apt-get install avahi-utils

Then at run time you can run something like this:

# enable communication to hostOS dbus
export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket

avahi-publish -s $HOSTNAME _xxx._tcp 1883 "Status=Running" "Version=1.0" &> /dev/null &

replace xxx with whatever you want your service to be seen as and replace 1883 with the port you want it to tell other services it is listening on.