flungo/avahi

By flungo

Updated 9 months ago

Docker image for the Avahi mDNS/DNS-SD daemon.

Image

100K+

Avahi Docker Image

Docker image for the Avahi mDNS/DNS-SD daemon. Built on Alpine Linux to make the image as small as possible. Highly configurable through environment variables to support most usecases which need an Avahi Daemon.

Usage

Basic usage consists of running the docker container with the appropriate environment variables and volumes to achieve your desired behaviour.

docker run flungo/avahi

Environment variables

Environment variables are made available for all of the options of avahi-daemon.conf. The variable names are in the format <SECTION>_<OPTION> where <SECTION> is the capitalised section name from the configuration file and <OPTION> is the capitalised option name with - replaced by _. The table below outlines the available options:

SectionOptionVariable
serverhost-nameSERVER_HOST_NAME
serverdomain-nameSERVER_DOMAIN_NAME
serverbrowse-domainsSERVER_BROWSE_DOMAINS
serveruse-ipv4SERVER_USE_IPV4
serveruse-ipv6SERVER_USE_IPV6
serverallow-interfacesSERVER_ALLOW_INTERFACES
serverdeny-interfacesSERVER_DENY_INTERFACES
servercheck-response-ttlSERVER_CHECK_RESPONSE_TTL
serveruse-iff-runningSERVER_USE_IFF_RUNNING
serverenable-dbusSERVER_ENABLE_DBUS
serverdisallow-other-stacksSERVER_DISALLOW_OTHER_STACKS
serverallow-point-to-pointSERVER_ALLOW_POINT_TO_POINT
servercache-entries-maxSERVER_CACHE_ENTRIES_MAX
serverclients-maxSERVER_CLIENTS_MAX
serverobjects-per-client-maxSERVER_OBJECTS_PER_CLIENT_MAX
serverentries-per-entry-group-maxSERVER_ENTRIES_PER_ENTRY_GROUP_MAX
serverratelimit-interval-usecSERVER_RATELIMIT_INTERVAL_USEC
serverratelimit-burstSERVER_RATELIMIT_BURST
wide-areaenable-wide-areaWIDE_AREA_ENABLE_WIDE_AREA
publishdisable-publishingPUBLISH_DISABLE_PUBLISHING
publishdisable-user-service-publishingPUBLISH_DISABLE_USER_SERVICE_PUBLISHING
publishadd-service-cookiePUBLISH_ADD_SERVICE_COOKIE
publishpublish-addressesPUBLISH_PUBLISH_ADDRESSES
publishpublish-hinfoPUBLISH_PUBLISH_HINFO
publishpublish-workstationPUBLISH_PUBLISH_WORKSTATION
publishpublish-domainPUBLISH_PUBLISH_DOMAIN
publishpublish-dns-serversPUBLISH_PUBLISH_DNS_SERVERS
publishpublish-resolv-conf-dns-serversPUBLISH_PUBLISH_RESOLV_CONF_DNS_SERVERS
publishpublish-aaaa-on-ipv4PUBLISH_PUBLISH_AAAA_ON_IPV4
publishpublish-a-on-ipv6PUBLISH_PUBLISH_A_ON_IPV6
reflectorenable-reflectorREFLECTOR_ENABLE_REFLECTOR
reflectorreflect-ipvREFLECTOR_REFLECT_IPV
rlimitsrlimit-asRLIMITS_RLIMIT_AS
rlimitsrlimit-coreRLIMITS_RLIMIT_CORE
rlimitsrlimit-dataRLIMITS_RLIMIT_DATA
rlimitsrlimit-fsizeRLIMITS_RLIMIT_FSIZE
rlimitsrlimit-nofileRLIMITS_RLIMIT_NOFILE
rlimitsrlimit-stackRLIMITS_RLIMIT_STACK
rlimitsrlimit-nprocRLIMITS_RLIMIT_NPROC

If you find an option you require is missing, report this or make a PR adding that feature.

Examples

This sections contains several example usages for the. If you use this container for a common scenrio or if any of the examples can be improved, please let me know the configurtion you have used so that I can add it here or submit a PR adding it as an example.

Reflect mDNS broadcasts between networks

To reflect mDNS broadcasts between two docker networks (net1 and net2 in the example given) the reflector should be enabled by setting REFLECTOR_ENABLE_REFLECTOR=yes.

# Create a container named mdns-reflector attached to net1
docker run -d --name=mdns-reflector \
  --network net1 \
  -e REFLECTOR_ENABLE_REFLECTOR=yes \
  flungo/avahi
# Attach the container to the net2 network
docker network connect net2 mdns-reflector

See Connecting to a phyiscal network to see how you can connect the container to a physical network - for example if you wanted to reflect mDNS between two WiFi VLANs).

Connecting to a physical network

It is common to want to use this container with one or more physical networks (e.g. as a reflector between WiFi network), in order to do this a docker network can be created using the macvlan driver. The following example creates a macvlan network named physical connected to the eno1 interface with subnet 10.0.0.0/24 and gateway 10.0.0.1.

docker network create --driver macvlan --subnet 10.0.0.0/24 --gateway 10.0.0.1 --opt parent=eno1 physical

You can also connect to a VLAN on a physical interface by suffixing the parent with . and the VLAN ID (e.g. --opt parent=eno1.123 for VLAN 123 on the eno1 interface. The sub-interface does not need to exist before running the command to create the network as the driver will automatically create this.

To ensure that an IP conflict does not occur, you should specify an available IP address on your physical network when attaching the network to your container. Assuming that your container is called avahi and 10.0.0.1 is an available IP in that network, you can connect this network as follows:

docker network connect physical avahi --ip 10.0.0.10

Docker Pull Command

docker pull flungo/avahi