Running HomeAssistant on CE


This topic is for those of you trying to run Docker containers that use python-zeroconf and get the error messages like “[Errno 98] Address already in use”.
Example are the HomeAssistant and ESPHome containers.


HomeAssistant requires to set the network mode as host, meaning that all ports that are open by the container will be bind to the hosts (in this case CE) interface.

The missing information is that HomeAssistant auto discovery uses python-zeroconf that needs to bind to UDP port 5353, that is the port used for nDNS, zeroconf, avahi, bonjour (whatever you want to call it)

But by default CE’s avahi-daemon configuration denies to have multiple processes binding to that port, as per:


Solution 1: the neatest solution would be to open a PR to change the default value :slight_smile: but despite the age of the comment (2013) I’m afraid that it would cause issues to some users.

Solution 2: But there’s a workaround, one just need to have a configuration file that allows multiple processes to bind to the above mentioned UDP port and restart the avahi-daemon with this new file.


cp /etc/avahi/avahi-daemon.conf /storage/.config/avahi-daemon.conf
sed -e "s,^.*disallow-other-stacks=.*$,disallow-other-stacks=no,g" -i /storage/.config/avahi-daemon.conf

Create the file /storage/.config/system.d/avahi-daemon-stacks.service with the contents:

Description=Avahi Daemon avahi-defaults.service

ExecStart=/usr/sbin/avahi-daemon -f /storage/.config/avahi-daemon.conf -s $AVAHI_DEBUG
ExecReload=/usr/sbin/avahi-daemon -r


And finally, create a /storage.config/ if you don’t have one yet, don’t forget to add execution bit (chmod +x /storage.config/ and add the followinf to it:

systemctl stop avahi-daemon
sleep 2
systemctl start avahi-daemon-proxy
) &

Hope it works for you, good luck