Multicast not working even with net=host

Hi All,

I’m trying to host a project on a computer that lives on my local network and have it discoverable via mDNS.
Ideally I have everything in a docker-compose.yml however I can’t get basic multicasting working when the app is containerised and using network_mode: "host"

The application is located here: mdns/examples at master · spider-gazelle/mdns · GitHub
If the application is run directly on the host via crystal ./examples/ then everything works as expected.

However if I run the application via docker, i.e. this example docker-compose
(link to the dockerfile for the image specified)

version: "3.7"

    image: placeos/mdns-service:latest
    restart: always
    container_name: drivers-mdns
    network_mode: "host"
      DOMAIN_NAMES: myservice.local
      IP_ADDRESS: ""

then running ping myservice.local fails only when running the app in the container.
Given I’ve specified network_mode: host I would expect no difference in behaviour… Anyone have any ideas?

I think I found the issue: routes - Reroute mDNS query from WSL subnet to windows host subnet - Stack Overflow

Seems to be the fact that Docker Desktop runs in a VM so the --net=host flag doesn’t actually connect to the host network…

Things work fine when running on a Linux host

The observations are correct.

I am surprised the forum search didn’t yield any useful results for this topic, as multicast and host network with docker desktop have already been discussed a couple of times.

1 Like