for-mac icon indicating copy to clipboard operation
for-mac copied to clipboard

M1 Mac address already in use port 53 by mDnsResponder

Open dmnlk opened this issue 5 years ago • 39 comments

  • [x] I have tried with the latest version of Docker Desktop
  • [x] I have tried disabling enabled experimental features
  • [ ] I have uploaded Diagnostics
  • Diagnostics ID:

Expected behavior

compose up dns Container (using port 53)

Actual behavior

ERROR: for dev-dns Cannot start service dev-dns: Ports are not available: listen udp 0.0.0.0:53: bind: address already in use

Information

  • macOS Version: BigSur 11.2
  • Docker Desktop Version: 3.1.0 (60984)

I'm using docker-compose and try to up dnsmasq Container with port 53.

  dev-dns:
    image: myenv/dnsmasq:latest
    hostname: dev-dns
    container_name: dev-dns
    environment:
      DNS_SERVER: 8.8.8.8
      DOCKER_DNS_SERVER: 172.19.10.250
      DOCKER_DNS_TLD: localhost
    privileged: true
    networks:
      mynet:
        ipv4_address: 172.19.10.250
      - "53:53/udp"
      - "53:53/tcp"

But, can't up this container, an error message is below

ERROR: for dev-dns  Cannot start service dev-dns: Ports are not available: listen udp 0.0.0.0:53: bind: address already in use

Port53 is used by mDnsResponder process, but can't disable mDnsResponder unless i use SIP.

how to resolve it?

dmnlk avatar Feb 12 '21 07:02 dmnlk

I hope we get some help with this. I am running into the same error by trying to install pi-hole which needs port 53 on docker (running docker Apple M1 Tech Preview 7). When docker is not running port 53 is open. As soon as I start docker, mDNSresponder starts listening:

% sudo lsof -nP -i4TCP:53
COMMAND   PID           USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
mDNSRespo 456 _mdnsresponder   45u  IPv4 0x44f11e400a44b1a3      0t0  TCP *:53 (LISTEN)

This seems to be a docker issue on M1 macs? My intel mac running current stable docker does not have this issue and never did.

verityj avatar Feb 13 '21 14:02 verityj

I'm also running into this issue on Docker m1 tech preview version 3.1.0 (60984).

Repro steps:

Create a new docker-compose file with the following contents, then bring it up with docker-compose up --build -d. This is based off the pi-hole example.

version: "3"

# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp"
      - "80:80/tcp"
      - "443:443/tcp"
    environment:
      TZ: 'America/Chicago'
      # WEBPASSWORD: 'set a secure password here or it will be random'
    # Volumes store your data between container upgrades
    volumes:
      - './etc-pihole/:/etc/pihole/'
      - './etc-dnsmasq.d/:/etc/dnsmasq.d/'
    # Recommended but not required (DHCP needs NET_ADMIN)
    #   https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
    cap_add:
      - NET_ADMIN
    restart: unless-stopped

dustinsoftware avatar Feb 14 '21 04:02 dustinsoftware

Having the same issue.

mspych avatar Feb 17 '21 17:02 mspych

Able to reproduce as well. Same setup, disabled SIP and mDnsResponder, port opens, DNS stopped resolving. Hope we have a solution soon, back to my old laptop. ☹️

adam404 avatar Feb 19 '21 00:02 adam404

Not sure if this helps with your particular setups, but this helped me: https://gist.github.com/ogrrd/5831371

griffithben avatar Feb 23 '21 03:02 griffithben

The issue is caused by Internet sharing - disable it and port 53 will not be used by mDNSResponder!

miraclebg avatar Feb 27 '21 16:02 miraclebg

The issue is caused by Internet sharing - disable it and port 53 will not be used by mDNSResponder!

Unfortunately that didn't work for me. Newest docker preview 3.1.0 (60984) just installed on brand new M1 and everything unselected under System Preferences - Sharing. As soon as docker starts, port 53 gets occupied. Quit docker and port 53 is open.

verityj avatar Feb 27 '21 17:02 verityj

I se this periodically. Looking for the duplicate issue. This is not just in M1.

rfay avatar Mar 01 '21 23:03 rfay

The issue is caused by Internet sharing - disable it and port 53 will not be used by mDNSResponder!

Internet sharing is disabled. The port is not occupied while Docker is not running. But for me (Apple Silicon, M1) it becomes occupied when starting Docker.

asixseight avatar Mar 03 '21 14:03 asixseight

Having the same issue.

javieranfix avatar Mar 11 '21 15:03 javieranfix

Same issue on Intel Mac (Mac Mini 2018) running Big Sur V11.2.3.

marksthomas avatar Mar 12 '21 13:03 marksthomas

Same issue, Intel mac (mac mini pro 2019) Big Sur 11.2.3.

Any help would be appreciated.

cpv92 avatar Mar 12 '21 21:03 cpv92

For Intel Mac's turning off the experimental feature "Use new virtualization framework" may help. On M1 there isn't such switch, because that's the only way to run the Docker Desktop VM. We're investigating...

StefanScherer avatar Mar 13 '21 10:03 StefanScherer

Flag was already turned off when I got this error.

fgm avatar Mar 13 '21 15:03 fgm

We think that the new MacOS virtualization framework reserves port 53 so that it is no longer available for containers. We have filed a ticket with Apple.

stephen-turner avatar Mar 15 '21 10:03 stephen-turner

As a workaround, binding to port 53 at a specific IP address should work, e.g., docker run -p 127.0.0.1:53:53.

stephen-turner avatar Mar 15 '21 18:03 stephen-turner

Upgrading to 3.2.2 (61853) resolved for me.

The release notes mention this issue as resolved with "Fixed an issue that stopped containers binding to port 53. Fixes docker/for-mac#5416. "

https://docs.docker.com/docker-for-mac/release-notes/

here avatar Mar 18 '21 02:03 here

Fixed my problem too.

On Thu, 18 Mar 2021 at 03:40, mikey dubs @.***> wrote:

Upgrading to 3.2.2 (61853) resolved for me.

The release notes mention this issue as resolved with "Fixed an issue that stopped containers binding to port 53. Fixes #5416 https://github.com/docker/for-mac/issues/5416. "

https://docs.docker.com/docker-for-mac/release-notes/

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/docker/for-mac/issues/5335#issuecomment-801573729, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABC7TZBNMFPQ26XSL2SVJ3TEFR3BANCNFSM4XQF5DBA .

--

This email, including any attachments, is confidential and may be privileged. If you are not the intended recipient please notify the sender immediately, and please delete it; you should not copy it or use it for any purpose or disclose its contents to any other person. If the email, including any attachments, is legally privileged, you should not forward it to any other person.

fgm avatar Mar 18 '21 08:03 fgm

The fix in 3.2.2 is a different issue. I realise they're confusingly similar, but that was about a Docker DNS daemon taking port 53. This issue is about a MacOS DNS daemon taking port 53 on M1 machines. 3.2.2 is an Intel release, so is not relevant to this bug.

stephen-turner avatar Mar 18 '21 10:03 stephen-turner

Is there any indication from Apple if this is something that can be remedied quickly?

RA-nateblanchette avatar Mar 18 '21 17:03 RA-nateblanchette