Does Docker work with mDNS?

My set up:

  • Linux machine with hostname remex-02 running Gitea 1.20.2
  • Windows machine running Docker Desktop v4.22.1

Both machines are correctly exposing their hostname and IP with mDNS.

When I try

docker login remex-02.local:3000

On the client I get

Authenticating with existing credentials...
Login did not succeed, error: Error response from daemon: Get "https://remex-02.local:3000/v2/": dialing remex-02.local:3000 with direct connection: resolving host remex-02.local: lookup remex-02.local: getaddrinfow: This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server.

However the server logs indicate Docker did manage to connect:

Sep  2 10:13:04 remex-02 gitea[3972]: 2023/09/02 10:13:04 ...eb/routing/logger.go:102:func1() [I] router: completed GET /v2/ for [server-ipv6%wlan0]:52511, 401 Unauthorized in 0.2ms @ container/container.go:118(container.ReqContainerAccess)
Sep  2 10:13:06 remex-02 gitea[3972]: 2023/09/02 10:13:06 ...eb/routing/logger.go:102:func1() [I] router: completed GET /v2/token?account=mark&client_id=docker&offline_token=true&service=container_registry for, 200 OK in 1121.5ms @ container/container.go:142(container.Authenticate)

It’s as if at first DNS resolution is aware of mDNS, and later it isn’t. Has anyone experience with this set up? Any ideas if it possible at all, and if so how?

The docker engine will use the dns resolver configured in /etc/resolv.conf.
A container started in the docker engine will use docker’s build-in dns resolver, which uses the resolvers from the hosts /etc/resolv.conf as upstream.

Looks like mDNS is running on your host and binds to an ip in the range Of course a container will not be able to access it there.

It would work for the host and the containers, if mDNS is configured to bind the port to the ip (by default: of docker0 interface, it would be reachable from the host and the containers, without exposing the service to your lan. If your lan ip is static, you could use your lan ip instead and expose the resolver to your whole lan.