I managed to have some luck with this. My code looks similar to yours OP, but my compose entry looks a bit different, and I wonder if your issue was simply related to network: host
. Shouldn't it be network_mode: host
and outside of build
?
services:
avahi:
build:
context: ./config/avahi
dockerfile: DockerFile
network_mode: host
cap_add:
- NET_ADMIN
- NET_BROADCAST
On another note, I'm running into hostname conflicts between Avahi in the container and the host. Need to confirm, but setting disable-publishing=yes
in the host avahi-daemon.conf is showing promise, in case it helps anyone else and is suitable for your use case.