“Docker.app” will damage your computer. You should move it to the Bin

I got this crazy error “Docker app will damage your computer you should move it to the Trash” the other day.

I’m stuck in a loop. I can’t cancel, it just reappears, I can’t move to bin it just errors - then reappears.

I didn’t use Docker for a couple of months on my Macbook pro M1 running Sonoma 14.7. No changes were made, I just did not use Docker for a while. I did NOT apply any updates also for a while.

Following commands helps me resolve my problem

1
2
brew uninstall --cask docker --force
brew uninstall --formula docker --force

Resolving the “Docker.app will damage your computer” Warning on macOS

The warning message “'Docker.app' will damage your computer” on macOS indicates that macOS’s security features, such as Gatekeeper, have flagged Docker as potentially harmful. This warning can arise from:

  1. A false positive by macOS or antivirus software.
  2. A corrupted Docker installation.
  3. A compromised Docker binary downloaded from an untrustworthy source.

Here’s how you can resolve this issue step-by-step:


1. Verify the Source of Docker

Ensure you downloaded Docker Desktop from its official source. If not:

  • Delete the current installation of Docker immediately.
  • Download a fresh copy from the official website:
    • Docker Desktop Official Website

2. Update macOS

Make sure your macOS is up-to-date, as updates can resolve false-positive security alerts.

  1. Go to System Preferences > Software Update.
  2. Install any pending updates.
  3. Restart your system and retry launching Docker.

3. Check for Malware

The warning could also indicate that the Docker binary has been tampered with. Scan your system for malware using reliable tools:

  • Use macOS’s built-in malware scanner:
    • macOS may have quarantined Docker. Open System Preferences > Security & Privacy > General and check if there’s an option to allow Docker.
  • Run a third-party malware scan:
    • Use trusted software like Malwarebytes for Mac.

4. Reinstall Docker Desktop

To ensure a clean installation:

Remove the Existing Docker Installation

  1. Open Terminal and run the following commands to remove Docker and related files:bash
    sudo rm -rf /Applications/Docker.app
    sudo rm -rf ~/Library/Group\ Containers/group.com.docker
    sudo rm -rf ~/Library/Containers/com.docker.docker
    sudo rm -rf ~/Library/Application\ Support/Docker\ Desktop
    sudo rm -rf ~/.docker
  2. Clear cached Docker preferences:bash
    sudo rm -rf ~/Library/Preferences/com.docker.docker.plist

Reinstall Docker

  1. Download Docker Desktop from the official website:
    • Docker Desktop
  2. Install it by dragging the .app file to your Applications folder.
  3. Open Docker Desktop. If prompted, follow the instructions to allow it through macOS security.

5. Manually Allow Docker in Gatekeeper

If Docker is still flagged after reinstalling:

  1. Open System Preferences > Security & Privacy > General.
  2. You should see a message that Docker was blocked. Click Allow Anyway.

Alternatively, use Terminal to manually override Gatekeeper for Docker:

1
2
3
sudo spctl --add /Applications/Docker.app  
sudo xattr -rd com.apple.quarantine /Applications/Docker.app


6. Verify Docker Installation

To confirm Docker is working correctly:

  1. Open Terminal and run:bash
    docker --version
  2. Run a test container:bash
    docker run hello-world
    If Docker is correctly installed, you’ll see a success message.

7. Report to Docker or Apple

If the issue persists and you suspect a false positive:

  • Report the issue to Docker Support: Docker Support
  • Submit feedback to Apple: Apple Feedback