Cannot resolve .local addresses from within Home Assistant docker container

I don’t seem able to use or resolve .local (mDNS) hostnames from within the default Home Assistant Docker container.

Network mode is set to host. On the host system I can resolve .local hostnames for devices on my network. If I try to use any of those .local hostnames from within the container, it fails.

I’ve been googling a bunch to try understand what the problem is and how to fix it but I’ve mostly found explanations for how to make mDNS work without network mode host or how to announce the docker container itself with a mDNS entry, neither of which I am interested in.

I just want to be able to use myservicehost.local from within the Home Assistant container.

Any thoughts / advice / pointers?

Thanks!

Context: My router “melted” today and I had to completely patch up my network to at least function with basic capability until I was able to replace and reconfigure a new router. This caused me to loose many services and having to update many configurations based on them now pointing at the wrong IP addresses. As a takeaway from this I want to make an effort to more heavily rely on mDNS as a more flexible way to address and discover hosts across my network.

Not convinced of that myself :wink:

Whatever you use as DHCP doesn’t act as DNS as well, dnsmasq style? If so, you typically have .lan addresses readily available…

No, right now, I am using my internet provider plastic cable modem as router and DHCP server (also see “Context” above). It does not provide DNS itself at all.

When my main network router broke (which WAS running a DNS server, but mostly for caching purposes), notably, hosts and services that are addressing each other with mDNS where the only parts of my smart home that resumed working without requiring any reconfiguration. Everything else that was using either DNS names resolved by the router or IP addresses across multiple VLANs and subnets directly, required fixing of configurations in numerous different locations.

My temporary router is not capable of routing between VLANs (which means, currently I have most of my critical devices swarming a single large IP network) or able do static IP address assignments. If I was mostly using mDNS host names however, none of this would matter and most services would just resume working even with an entirely completely changed network and topology.

But even if my temporary router could do these things, it would still require lots of manual configuration and re-setting up, at least as long as I cannot import my old routers configuration into my temporary (which in this case I cannot). Had I more heavily used mDNS, due to it’s distributed nature, most of my network/smart home would have just “healed” itself. And as I mentioned above, the things that are using mDNS did so.

While I appreciate your input I really would like to know how I can get mDNS working inside the Docker container. I believe Home Assistant itself already uses zeroconf/mDNS for service discovery, but I assume not through the core OS mechanisms, which do not seem to be working correctly: docker exec -it home-assistant /bin/ping myhost.local will lead to a bad address error whereas ping myhost.local on the same shell on the Docker host will resolve the address correctly.