mDNS in container with mDNS enabled on TrueNAS

So I am trying to get Scrypted working on TrueNAS. It is installed from the packages. Comes up and works to the point of being able to configure it. The issue however is the HomeKit plugin. Trying to add it to HomeKit always fails. After a bit of research it seems like the answer it to go into the general network setting and disable mDNS for TrueNAS because any container that uses mDNS it will fail because of the port bindings. The container is setup to use “host network”. My system setup is a single ethernet net that is bound to a br0 interface that has the IP address. I have tried the other options for setting up the container. If I disable mDNS on the TrueNAS system then of services the TrueNAS server is not discoverable on the network. Real catch-22.

Is there a recommendation on how to solve conflicts like this?

Port conflicts are a consequence of sharing the host network with containers. I use host networking for the Home Assistant container, which has a similar conflict, and I just disabled mDNS on the TrueNAS host. Windows machines still find the TrueNAS instance via WS-Discovery, but I can’t speak for Linux boxes or Macs.

If that’s not a viable option for you, you’ll want to find a way to give the Docker container its own address on your LAN, with its own unique port 5353 to bind the mDNS listener on. One simple way would be to run Docker inside a TrueNAS-managed VM or LXC, which can pull its own address via normal means (DHCP, SLAAC, etc.).

If you want to keep to a single Docker engine directly on the TrueNAS host, and you don’t want to disable the conflicting service, you can still set up a Docker macvlan network to give the container its own address instead. I personally dislike that option because it’s yet another place to manually configure LAN addresses, but it is a valid path forward.

Note that I’m assuming you manually manage your Docker containers via docker compose (and maybe a helper like Komodo or Portainer). I have no idea how much of the above is doable via the TrueNAS “apps” ecosystem, as I don’t use it (aside from a “custom app” to manage the Compose file that bootstraps Komodo to manage my other containers).

Edit: YMMV, I’m just passing this tutorial on without endorsing it, but it sounds like TrueNAS does now allow assigning custom IP addresses to “app” containers. I don’t know how they translate that into Docker networks under the hood, though. (Frankly, as soon as you’re doing anything even slightly “fancy” with your apps, I would highly recommend just using docker compose directly, as that avoids any confusion about how TrueNAS chooses to label concepts and map them to the underlying infra.)

2 Likes

Thanks for taking the time for the detailed reply! I looked at the video and it seems the alias only works when you are using VLAN interfaces, which will not work for me as I am looking to have this on my main network. Over all at this point I have become frustrated with the progress on virtualization on TrueNAS and have given up. I am as I typing Proxmox is being installed on a system next to me. There was a feature request opened in the past asking to sort out this issues and it was closed as will not do. Oh well.

I would love to now how to get mDNS to work between a container and the host.
A the moment i mount the DBUS socket into containers that have acces to a avahai demaon.
And have a script generate and mount a /etc/host into containers that dont.

For containers with a docker mcvlan networks cant listen to the host broadcast. and i seem to fail in getting the ip routing correct for that to work