Matterbridge mDNS reflector

This project aims to use Matterbridge in these configurations:

Docker type Docker network OS Ipv4 Ipv6 Share (3) Home Assistant Matter Server
Docker Desktop bridge (1) Windows
Docker Desktop bridge (1) macOS
Docker Engine bridge (2) Linux

(1) - Network host in this configuration is useless cause Docker runs inside a VM.

(2) - Network host in this configuration works already out of the box cause Docker runs on the host.

(3) - Share mDNS between separate containers.

It can also be used to run Home Assistant and Matter Server inside Docker Desktop on Windows and macOS (with network bridge) without using complex VM. You just copy paste this docker-compose.yml.

Since the mDNS are shared between reflector clients, you can pair Matterbridge running with Docker Desktop to Home Assistant running with Docker Desktop. Even on the same machine.

Buy me a coffee

Prerequisites

Docker Desktop requirements for Windows and macOS

See Docker Desktop docs.

Dual Stack IPv4/IPv6 mDNS enabled and No filtering

alt text

Run Matterbridge in a Docker Desktop container

We use named volumes for storage, plugins and mattercert.

We publish the default matterbridge frontend port 8283.

We publish the matter port range 5550-5559 to allow childbridge mode and server node devices (RVCs).

macOS

docker stop matterbridge-test
docker rm matterbridge-test
docker pull luligu/matterbridge:dev
docker run -dit --restart unless-stopped --name matterbridge-test \
  -p 8283:8283 -p 5550-5559:5550-5559/udp \
  -v storage:/root/.matterbridge -v plugins:/root/Matterbridge -v mattercert:/root/.mattercert \
  luligu/matterbridge:dev matterbridge --docker --frontend 8283 --port 5550
docker logs --tail 1000 -f matterbridge-test

powerShell

docker stop matterbridge-test
docker rm matterbridge-test
docker pull luligu/matterbridge:dev
docker run -dit --restart unless-stopped --name matterbridge-test `
  -p 8283:8283 -p 5550-5559:5550-5559/udp `
  -v storage:/root/.matterbridge -v plugins:/root/Matterbridge -v mattercert:/root/.mattercert `
  luligu/matterbridge:dev matterbridge --docker --frontend 8283 --port 5550
docker logs --tail 1000 -f matterbridge-test

You will see that the frontend inside the container is listening on the conainer address

[09:02:10.140] [Frontend] The frontend http server is listening on http://172.17.0.2:8283
[09:02:10.140] [Frontend] The frontend http server is listening on http://[fd3d:8954:ffe5::2]:8283

But since we mapped the port 8283:

In the same way the Matter port range 5550-5559 is mapped outside the container to allow the controllers on the lan to discover and connect Matterbridge.

Optional: if you want to see the mDNS inside the Docker Desktop container

From another terminal run mb_mdns inside the container we created and run before

docker exec -it matterbridge-test mb_mdns --no-timeout

In a while you will see what mDNS packets are advertised inside the container

alt text

Optional: if you want to see ip and routing table inside the Docker Desktop container

From another terminal run ip a and ip r inside the container we created and run before

docker exec -it matterbridge-test apt-get update
docker exec -it matterbridge-test apt-get install -y --no-install-recommends iproute2 iputils-ping net-tools dnsutils tcpdump netcat-openbsd
docker exec -it matterbridge-test ip a
docker exec -it matterbridge-test ip r

Issues we have there

  1. The advertised mDNS packets cannot reach the host and the lan cause mDNS are not routed inside Docker Desktop

  2. The advertised mDNS packets contain wrong A and AAAA records:

Download and run the Madderbridge reflector server tray app directly on the host

OS Type Dowload Link
Windows Any arch .exe download
macOS Apple Silicon .dmg download
macOS Intel .dmg download
Ubuntu desktop .AppImage download
Ubuntu headless .deb download
Debian Any distro .deb download

You may need to approve the install while the try apps are not digitally signed.

Verify also that the firewall, if enabled, allows UDP for the app on public and private networks.

In a while you will see:

alt text

Run the Madderbridge reflector client in container

docker stop matterbridge-reflector
docker rm matterbridge-reflector
docker pull luligu/reflector-client:latest
docker run -dit --restart unless-stopped --name matterbridge-reflector luligu/reflector-client:latest
docker logs --tail 1000 -f matterbridge-reflector

In a while you will see:

alt text

Run Home Assistant and Matter Server in Docker compose with Docker Desktop

Prerequisites

You need the Matterbridge reflector server tray app running on the host from the tutorial above.

Run Home Assitant and Matter Server in Docker Compose with Docker Desktop

To test the sharing feature (it shares mDNS between all reflector clients), use this docker-compose.yml.

With this configuration Home Assistant (with Matter Server) works inside a Docker Desktop container without network host. When asked by Home Assistant, connect to Matter Server with ws://matterserver:5580/ws

docker compose down
docker compose pull
docker compose up -d --force-recreate
docker logs --tail 1000 -f reflector