I wish I could find the original source of the solution to give credit, but…
If you want to run home assistant in a docker container without --net=host or even in a swarm and maintain the discovery functionality the solution is do the following on the host(s).
Edit /etc/avahi/avahi-daemon.conf to have the following