docker / for-mac

Bug reports for Docker Desktop for Mac
https://www.docker.com/products/docker#/mac
2.43k stars 117 forks source link

Error response from daemon: is vmnetd running? #6677

Closed rbouma closed 1 year ago

rbouma commented 1 year ago

Expected behavior

When running our local devstack it needs to be binding to port 53 (priviliged port) and it needs to have the vmnetd running but is isn't stated in the error: Error response from daemon: Ports are not available: exposing port UDP 127.0.0.1:53 -> 0.0.0.0:0: failed to connect to /var/run/com.docker.vmnetd.sock: is vmnetd running?: dial unix /var/run/com.docker.vmnetd.sock: connect: no such file or directory

in the docs stated the following: If the privileged helper process is not running, Docker Desktop prompts the user for authorization to run it under launchd.

The priviliged port helper vmnet deamon needs to be installed when a prompt pops up and give permission.

Actual behavior

The prompt for installing the deamon never pops up and throws this error: Error response from daemon: Ports are not available: exposing port UDP 127.0.0.1:53 -> 0.0.0.0:0: failed to connect to /var/run/com.docker.vmnetd.sock: is vmnetd running?: dial unix /var/run/com.docker.vmnetd.sock: connect: no such file or directory

This happens every restart of docker for mac

Information

Output of /Applications/Docker.app/Contents/MacOS/com.docker.diagnose check

/Applications/Docker.app/Contents/MacOS/com.docker.diagnose check
Starting diagnostics

[PASS] DD0027: is there available disk space on the host?
[PASS] DD0028: is there available VM disk space?
[PASS] DD0018: does the host support virtualization?
[PASS] DD0001: is the application running?
[PASS] DD0017: can a VM be started?
[PASS] DD0016: is the LinuxKit VM running?
[PASS] DD0011: are the LinuxKit services running?
[PASS] DD0004: is the Docker engine running?
[PASS] DD0015: are the binary symlinks installed?
[PASS] DD0031: does the Docker API work?
[PASS] DD0013: is the $PATH ok?
[PASS] DD0003: is the Docker CLI working?
[PASS] DD0038: is the connection to Docker working?
[PASS] DD0014: are the backend processes running?
[PASS] DD0007: is the backend responding?
[PASS] DD0008: is the native API responding?
[PASS] DD0009: is the vpnkit API responding?
[PASS] DD0010: is the Docker API proxy responding?
[SKIP] DD0030: is the image access management authorized?
[PASS] DD0033: does the host have Internet access?
[PASS] DD0018: does the host support virtualization?
[PASS] DD0001: is the application running?
[PASS] DD0017: can a VM be started?
[PASS] DD0016: is the LinuxKit VM running?
[PASS] DD0011: are the LinuxKit services running?
[PASS] DD0004: is the Docker engine running?
[PASS] DD0015: are the binary symlinks installed?
[PASS] DD0031: does the Docker API work?
[PASS] DD0032: do Docker networks overlap with host IPs?
No fatal errors detected.

Steps to reproduce the behavior

  1. install docker desktop for mac 4.16.0
  2. stop and close your docker, then start it again
  3. docker-compose.yml >
    version: "3.9"
    services:
    dnsmasq:
    container_name: dnsmasq
    image: rollupdev/dnsmasq
    ports:
    - mode: ingress
      host_ip: 127.0.0.1
      target: 53
      published: "53"
      protocol: udp
    restart: always
  4. docker compose up
  5. you got error Error response from daemon: Ports are not available: exposing port UDP 127.0.0.1:53 -> 0.0.0.0:0: failed to connect to /var/run/com.docker.vmnetd.sock: is vmnetd running?: dial unix /var/run/com.docker.vmnetd.sock: connect: no such file or directory
rbouma commented 1 year ago

We fixed this temporary manually for now via:

we need to do this after every restart of docker desktop

check if the vmnetd launch service exists in /Library/PrivilegedHelperTools/com.docker.vmnetd otherwise copy them over with:

sudo cp /Applications/Docker.app/Contents/Library/LaunchServices/com.docker.vmnetd /Library/PrivilegedHelperTools/com.docker.vmnetd

check if the launch deamon exists in /Library/LaunchDaemons/com.docker.vmnetd.plist otherwise create it with:

sudo tee -a /Library/LaunchDaemons/com.docker.vmnetd.plist > /dev/null <<EOT
        <?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
        <plist version="1.0">
        <dict>
                <key>Label</key>
                <string>com.docker.vmnetd</string>
                <key>Program</key>
                <string>/Library/PrivilegedHelperTools/com.docker.vmnetd</string>
                <key>ProgramArguments</key>
                <array>
                        <string>/Library/PrivilegedHelperTools/com.docker.vmnetd</string>
                </array>
                <key>RunAtLoad</key>
                <true/>
                <key>Sockets</key>
                <dict>
                        <key>Listener</key>
                        <dict>
                                <key>SockPathMode</key>
                                <integer>438</integer>
                                <key>SockPathName</key>
                                <string>/var/run/com.docker.vmnetd.sock</string>
                        </dict>
                </dict>
                <key>Version</key>
                <string>64</string>
        </dict>
        </plist>
EOT

Last step is stop the vmnetd service if it is already running, unload, load the service and then start the vmnetd service again

sudo launchctl stop com.docker.vmnetd
sudo launchctl unload /Library/LaunchDaemons/com.docker.vmnetd.plist
sudo launchctl load /Library/LaunchDaemons/com.docker.vmnetd.plist
sudo launchctl start com.docker.vmnetd

this fixed our issue. but it will be better if docker is prompting for installing the deamon to use privileged ports such as 53

aiordache commented 1 year ago

Hi @rbouma. Looking at the logs you uploaded, we found a failed vmnetd install but no details on the actual error apart from an exit status. You can use the commands below to remove/install vmnetd:

/Applications/Docker.app/Contents/MacOS/install remove-vmnetd
/Applications/Docker.app/Contents/MacOS/install vmnetd

Do you mind trying them and check if the install is returning an error and if you can get more details on it please? Thanks!

rbouma commented 1 year ago

@aiordache

❯ /Applications/Docker.app/Contents/MacOS/install remove-vmnetd
❯ /Applications/Docker.app/Contents/MacOS/install vmnetd
Error: parsing Info.plist: reading plist /Applications/Docker.app/Contents/Info.Plist: open /Applications/Docker.app/Contents/Info.Plist: no such file or directory

found out that the Info.plist exists

❯ ls -altrh /Applications/Docker.app/Contents/
drwxr-xr-x user admin 128 B  Thu Dec  1 11:40:33 2022  Library
drwxr-xr-x user admin  96 B  Thu Dec  1 11:40:33 2022  Frameworks
.rw-r--r-- user admin   8 B  Thu Dec  1 11:40:34 2022  PkgInfo
.rw-r--r-- user admin 7.5 KB Thu Dec  1 11:40:37 2022  embedded.provisionprofile
drwxr-xr-x user admin  96 B  Thu Dec  1 11:40:37 2022  _CodeSignature
.rw-r--r-- user admin 3.4 KB Tue Jan 10 19:20:28 2023  Info.plist
drwxr-xr-x user admin 320 B  Fri Jan 13 09:22:00 2023  .
drwxr-xr-x user admin 608 B  Fri Jan 13 09:22:03 2023  MacOS
drwxr-xr-x user admin 512 B  Fri Jan 13 09:22:05 2023  Resources
drwxr-xr-x user admin  96 B  Fri Jan 13 09:26:22 2023  ..

We are all using Case Sensitive File System so Info.Plist is non exists on the system

After rename the file with sudo mv /Applications/Docker.app/Contents/Info.plist /Applications/Docker.app/Contents/Info.Plist the install commands does work

after correcting the name docker is not starting anymore so needed it to rename it back to Info.plist

It is working now without any problem even when i restart docker desktop or the whole system the error is not seen anymore.

So i think this is an issue due to our file system that is case sensitive and the names with the Info.plist and Info.Plist


Update: 01-16-2023 Information macOS Version: Ventura 13.1 Intel chip or Apple chip: Intel i9 Docker Desktop Version: v4.16.1

Again confirmed by a colleague running after running:

/Applications/Docker.app/Contents/MacOS/install remove-vmnetd
sudo mv /Applications/Docker.app/Contents/Info.plist /Applications/Docker.app/Contents/Info.Plist
/Applications/Docker.app/Contents/MacOS/install vmnetd
sudo mv /Applications/Docker.app/Contents/Info.Plist /Applications/Docker.app/Contents/Info.plist

it is working again.

So naming of the Info.Plist is not right.

aiordache commented 1 year ago

Sorry for this bug @rbouma. We'll get a fix in for the next release. Can you maybe duplicate the file and have it with both .Plist and .plist until then?

rbouma commented 1 year ago

@aiordache Yes i have both files in the directory and so far it is running good. Will wait for the next release thanks!

mat007 commented 1 year ago

We have just released Docker Desktop 4.16.2 with a fix!

rbouma commented 1 year ago

@mat007 great! Thanks

docker-robott commented 1 year ago

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

/lifecycle locked

monaw commented 1 year ago

i know this is closed but in case this helps anyone...in my case (MacOS 13.4, Docker Desktop Version 4.20.1), the steps mentioned above by rbouma, updated on 1-16 was close but didn't work. these steps worked for me:

  1. /Applications/Docker.app/Contents/MacOS/install remove-vmnetd
  2. sudo /Applications/Docker.app/Contents/MacOS/install vmnetd
jonmann20 commented 1 year ago

same as @monaw was happening for me on MacOS 13.4 and Docker Desktop 4.20.1

alanzheng88 commented 1 year ago

thanks @monaw! that resolved it for me on MacOS 13.4 and docker desktop 4.20.1

kay-o commented 1 year ago

Seems several projects have begun recommending Colima when using Docker on Mac. It seems to have solved this issue; trying it out further. (Colima describes itself as "container runtimes on macOS (and Linux) with minimal setup.")

annstringer commented 1 year ago

I can confirm that the solution by @monaw worked for me on MacOS 13.5.1 and Docker Desktop 4.23.

setswei commented 1 year ago

+1 can also confirm those steps work on 13.4.1 and docker 4.24.2

marcosbrasil commented 1 year ago

+1 I can confirm that the solution by @monaw worked for me on MacOS Sonoma 14.0 and Docker Desktop 4.24.2.

mogoman commented 1 year ago

worked for me in Ventura upgrading to 4.25.0

raoulwegat commented 11 months ago

Thanks @monaw! Also working for me on Docker Desktop 4.25.2 (129061) and Sonoma 14.1.1

sebastianricaldoni commented 11 months ago

Thanks @monaw . It worked for me as well

macOS: Sonoma 14.1.1
Docker: v4.25.2 (build 129061)
dhwani07 commented 11 months ago

Thanks @monaw works for me as well macOS: 13.5.2 Ventura, Docker v 4.25

bellu commented 11 months ago

i know this is closed but in case this helps anyone...in my case (MacOS 13.4, Docker Desktop Version 4.20.1), the steps mentioned above by rbouma, updated on 1-16 was close but didn't work. these steps worked for me:

  1. /Applications/Docker.app/Contents/MacOS/install remove-vmnetd
  2. sudo /Applications/Docker.app/Contents/MacOS/install vmnetd

Thanks @monaw it worked on Sonoma Version 14.1 (23B74)

manoj382 commented 11 months ago

i know this is closed but in case this helps anyone...in my case (MacOS 13.4, Docker Desktop Version 4.20.1), the steps mentioned above by rbouma, updated on 1-16 was close but didn't work. these steps worked for me:

  1. /Applications/Docker.app/Contents/MacOS/install remove-vmnetd
  2. sudo /Applications/Docker.app/Contents/MacOS/install vmnetd

Thankful to have tracked down this thread. Worked for me!

Docker: 4.24.2 (124339 macOS: Ventura 13.6 (22G120)

slackerzz commented 11 months ago

i know this is closed but in case this helps anyone...in my case (MacOS 13.4, Docker Desktop Version 4.20.1), the steps mentioned above by rbouma, updated on 1-16 was close but didn't work. these steps worked for me:

1. /Applications/Docker.app/Contents/MacOS/install remove-vmnetd

2. sudo /Applications/Docker.app/Contents/MacOS/install vmnetd

Docker Desktop 4.26.0 on MacOS Sonoma 14.2

This helped, but after that, I constantly needed to run docker system prune, otherwise, each time I start my containers (via docker compose) I get something like this:

Error response from daemon: network 0903dc942d8d6f31628875418f6e873f3872b61fd69c45e108eecd43d162e8ba not found
mitrol-design commented 10 months ago

One more for @monaw ’s solution - macOS Sonoma 14.2.1 & Docker Desktop 4.26.1 — Thanks

RootProgger commented 9 months ago

Same Problem on MacOS X Ventura, Docker Desktop 4.26.1. @monaw solution works, but I can't every time go to the Sysadmin when i restart Docker-Desktop to call Sudo

StephenHinck commented 9 months ago

MacOS Sonoma 14.2.1 with Docker Desktop v4.26.1, same issue and same fix from @monaw worked great. Would be great to get this fixed directly and not require a workaround.

nucsemin commented 9 months ago

Thanks a lot @rbouma. This solution worked for me.

taoeffect commented 6 months ago

I am running v4.29.0 on Sonoma 14.4.1, and still had to run @monaw's commands to get this to work.

Sounds like this hasn't been fixed? Can the issue be reopened?

StephenHinck commented 4 months ago

Updated to v4.31.0 today and it re-broke me. https://github.com/docker/for-mac/issues/6677#issuecomment-1593787335 is still necessary to resolve this issue :-/

RootProgger commented 4 months ago

Updated to v4.31.0 today and it re-broke me. #6677 (comment) is still necessary to resolve this issue :-/

i resolved this issue on my Mac with complete deinstall docker desktop (including remove config files) and reinstall new version.

ThePlastic commented 4 months ago

Updated to v4.31.0 today and it re-broke me. #6677 (comment) is still necessary to resolve this issue :-/

i resolved this issue on my Mac with complete deinstall docker desktop (including remove config files) and reinstall new version.

tried, issue still present

marcosbrasil commented 4 months ago

I can confirm the same here as @StephenHinck

StephenHinck commented 4 months ago

@ThePlastic - reinstall has worked for me so far (and the fix has persisted through one upgrade). Follow the full instructions here: https://docs.docker.com/desktop/uninstall/, including the three terminal commands.

KurtRogers commented 4 months ago

Insane. @monaw you are a legend. The commands are still needed.

Docker v4.31.0 (153195)

image

MacOS 14.5 (23F79)

ThePlastic commented 4 months ago

@ThePlastic - reinstall has worked for me so far (and the fix has persisted through one upgrade). Follow the full instructions here: https://docs.docker.com/desktop/uninstall/, including the three terminal commands.

I didi it, step by step, still need the 2 commands listed above....

brittonwalker commented 3 months ago

The solve that worked for me was going to Settings -> Advanced and selecting "Allow privileged port mapping". If it is already selected, which in my case was, I had to uncheck, apply changes, and check again. Solved my issue.

ryan-ashbrook commented 3 months ago

i know this is closed but in case this helps anyone...in my case (MacOS 13.4, Docker Desktop Version 4.20.1), the steps mentioned above by rbouma, updated on 1-16 was close but didn't work. these steps worked for me:

  1. /Applications/Docker.app/Contents/MacOS/install remove-vmnetd
  2. sudo /Applications/Docker.app/Contents/MacOS/install vmnetd

Worked for me as well.

carbone commented 2 months ago

i know this is closed but in case this helps anyone...in my case (MacOS 13.4, Docker Desktop Version 4.20.1), the steps mentioned above by rbouma, updated on 1-16 was close but didn't work. these steps worked for me:

  1. /Applications/Docker.app/Contents/MacOS/install remove-vmnetd
  2. sudo /Applications/Docker.app/Contents/MacOS/install vmnetd

Worked for me as well.

Same. Thanks!

kevinquillen commented 2 months ago

This still happens (reported to me several times this week) and yet the issue is closed, and the fix is still to run the two commands.

working-name commented 1 month ago

@mat007 maybe a regression but it's not fixed in 4.20.1

timohuisman commented 3 weeks ago

i know this is closed but in case this helps anyone...in my case (MacOS 13.4, Docker Desktop Version 4.20.1), the steps mentioned above by rbouma, updated on 1-16 was close but didn't work. these steps worked for me:

  1. /Applications/Docker.app/Contents/MacOS/install remove-vmnetd
  2. sudo /Applications/Docker.app/Contents/MacOS/install vmnetd

Still got the issue in 4.34.3, ^ fixes the problem for me aswel.