For an IoT system there is the requirement that base stations automatically discover nearby devices, and then connect to them. The software on the base stations is deployed using docker-compose.
Services advertise using mDNS (zeroconf), and identify themselves as being of the type mytype
. Clients use aiozeroconf to discover services matching _mytype._tcp.local.
.
The problem is that clients inside a docker-compose network don't discover services in the LAN network - even if they are otherwise reachable.
Currently, I have the following setup:
LAN (Wifi)
- IoT device
- ServiceA
- Host / base station
- ClientA
- Docker-compose network
- ServiceB
- ClientB
Is this scenario considered out-of-spec for mDNS (ServiceA no longer considered in .local), or can this be solved?
You can use mdns-repeater to forward mDNS packets from the host network to the Docker network and enable the containers to discover devices in your LAN.