Fix Docker treated as malware issue by MacOS
What happened?
Last night when I reboot my computer after some Python stuff setup, MacOS starts to complaints about Docker. Prompts warning Docker is malware and ask me to delete it.
Then I start searching the Internet to find out why…
It turns out many of us was being frustrated by this sudden error comes up without doing anything and after installing Docker for years.
The reason behind is that the certificate of com.docker.vmnetd
has been revoked, and no one knows why this can happen.
The official fix is to update Docker to version 4.37.2
, which released just 3 days ago (2025-01-09). However this only applies to who can launch Docker Desktop and click the update button.
Most of us was stuck into a pop up loop hell that even you click put docker into bin, the pop up is still showing up every fill seconds.
What I’ve tried
First attempt
Some has suggested to
sudo cp /Applications/Docker.app/Contents/Library/LaunchServices/com.docker.vmnetd /Library/PrivilegedHelperTools/
Stopping the pop up loop
I had to use this script from official workaround to kill all running docker processes after putting Docker into bin before I can stop the pop up loop:
#!/bin/bash
# Stop the docker services
echo "Stopping Docker..."
sudo pkill '[dD]ocker'
# Stop the vmnetd service
echo "Stopping com.docker.vmnetd service..."
sudo launchctl bootout system /Library/LaunchDaemons/com.docker.vmnetd.plist
# Stop the socket service
echo "Stopping com.docker.socket service..."
sudo launchctl bootout system /Library/LaunchDaemons/com.docker.socket.plist
# Remove vmnetd binary
echo "Removing com.docker.vmnetd binary..."
sudo rm -f /Library/PrivilegedHelperTools/com.docker.vmnetd
# Remove socket binary
echo "Removing com.docker.socket binary..."
sudo rm -f /Library/PrivilegedHelperTools/com.docker.socket
# Install new binaries
echo "Install new binaries..."
sudo cp /Applications/Docker.app/Contents/Library/LaunchServices/com.docker.vmnetd /Library/PrivilegedHelperTools/
sudo cp /Applications/Docker.app/Contents/MacOS/com.docker.socket /Library/PrivilegedHelperTools/
New Problem
I assume the system is now clean so I can download and reinstall the latest version of Docker Desktop.
However once I install from the installer, MacOS has another complaints. It say Docker is damaged and cannot be started… 🙃
Install in another way
So it seems like installing via the Docker installer is not working. I uninstalled Docker and then install by Homebrew
:
brew update
brew reinstall --cask docker
The installation cannot complete, but it provides some insights:
==> Purging files for version 4.37.2,179585 of Cask docker
Error: It seems there is already a Binary at '/usr/local/bin/docker'.
Wait! Why the binaries still exists?
Solution
After I removed all existing Docker binaries in /usr/local/bin/
, the Homebrew installation script completed successfully.
hub-tool
com.docker.cli
kubectl.docker
docker
docker-compose
docker-credential-desktop
docker-credential-ecr-login
docker-credential-osxkeychain
docker-index
Open Docker Desktop again, you will be prompted for privilege and Docker can finally start normally again. :tada:
NOTE
If you failed the first time, you will probably need to delete /opt/homebrew/etc/bash_completion.d/docker
too before you try again.
To check if your Docker’s certificate is valid, use the check.sh
in this official workaround:
$ ./check.sh /Applications/Docker.app/Contents/Library/LaunchServices/com.docker.vmnetd
-----------------------------------------------------------------
Certificate details for com.docker.vmnetd:
serial=3EC22E699630083A
subject=UID=9BNSXJN65R
CN=Developer ID Application: Docker Inc (9BNSXJN65R)
OU=9BNSXJN65R
O=Docker Inc
C=US
issuer=CN=Developer ID Certification Authority
OU=Apple Certification Authority
O=Apple Inc.
C=US
notBefore=Oct 2 16:46:37 2024 GMT
notAfter=Feb 1 22:12:15 2027 GMT
-----------------------------------------------------------------
com.docker.vmnetd is signed with a correct certificate
NOTE 🪖 This is just my own experiences for someone that is unfortunate enough like me, which cannot fix it after trying the official fix. The fix on Docker documentation page below had cover different scenarios, you should try all of them before trying the way I mentioned above.