docker / for-mac

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

"Docker is damaged and can't be opened" error #7046

Closed aroc closed 5 months ago

aroc commented 11 months ago

Description

About once a week my docker for mac installation throws an error and wants me to delete it. This forces me to have to redownload and install Docker for mac. I get a MacOS alert with the message:

"Docker" is damaged and can't be opened. You should move it to the Trash.

CleanShot 2023-10-27 at 10 05 03@2x

After deleting and re-installing, one of two things happens

  1. Either my installation is now ok and works for another 7 days or so before repeating this error.
  2. I immediately get the error after re-install. If I reboot my computer, and re-install again, I often get outcome #1 above.

Though I'm not 100% sure, this seems to have started as of version 4.24.0, which I installed because I was excited about the new resource saver feature.

This has happened on version 4.24.0, 4.24.1, 4.24.2, and 4.24.5

Reproduce

  1. Install docker for mac
  2. Use it.
  3. Eventually get the error

Expected behavior

I don't expect this to happen at all

docker version

Client:
 Cloud integration: v1.0.35+desktop.5
 Version:           24.0.6
 API version:       1.43
 Go version:        go1.20.7
 Git commit:        ed223bc
 Built:             Mon Sep  4 12:28:49 2023
 OS/Arch:           darwin/arm64
 Context:           desktop-linux

Server: Docker Desktop 4.25.0 (126437)
 Engine:
  Version:          24.0.6
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.7
  Git commit:       1a79695
  Built:            Mon Sep  4 12:31:36 2023
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.22
  GitCommit:        8165feabfdfe38c65b599c4993d227328c231fca
 runc:
  Version:          1.1.8
  GitCommit:        v1.1.8-0-g82f18fe
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

Client:
 Version:    24.0.6
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2-desktop.5
    Path:     /Users/ericanderson/.docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.23.0-desktop.1
    Path:     /Users/ericanderson/.docker/cli-plugins/docker-compose
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     /Users/ericanderson/.docker/cli-plugins/docker-dev
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.20
    Path:     /Users/ericanderson/.docker/cli-plugins/docker-extension
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.9
    Path:     /Users/ericanderson/.docker/cli-plugins/docker-init
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     /Users/ericanderson/.docker/cli-plugins/docker-sbom
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     /Users/ericanderson/.docker/cli-plugins/docker-scan
  scout: Docker Scout (Docker Inc.)
    Version:  v1.0.9
    Path:     /Users/ericanderson/.docker/cli-plugins/docker-scout

Server:
 Containers: 18
  Running: 18
  Paused: 0
  Stopped: 0
 Images: 7
 Server Version: 24.0.6
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 8165feabfdfe38c65b599c4993d227328c231fca
 runc version: v1.1.8-0-g82f18fe
 init version: de40ad0
 Security Options:
  seccomp
   Profile: unconfined
  cgroupns
 Kernel Version: 6.4.16-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: aarch64
 CPUs: 10
 Total Memory: 19.51GiB
 Name: linuxkit-7ecc7eae69be
 ID: 1cff2712-a691-4ffe-b744-bcd48c853a64
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: daemon is not using the default seccomp profile

Diagnostics ID

18F45D69-1E4A-48FF-BF3D-918A69C6C5B0/20231027142839

Additional Info

This is happening to several of my co-workers as well. We're all on Apple Silicon, and coworkers on Intel macs don't seem to experience this issue.

rorylinehan-agora commented 11 months ago

Happened to me as well. I restarted, re-downloaded, and managed to install. But I can't build images now - 4.25.0 seems to be completely borked on M1 macOS Sonoma 14.1

faddah commented 10 months ago

+1 — I'm seeing this also, also opening a ticket with Docker Support and have posted on the Docker Slack #docker-desktop-mac channel —

Docker Support Issue — can't install Docker for Mac Apple Silicon (M2)

Here are my specs —

I had, I think, Docker Desktop app for Mac for Apple Silicon v4.24.1, and I tried to update in the Docker Desktop App to the new Docker Desktop app for Mac for Apple Silicon v4.25.0. Whenever I tried to update, it not only deleted my old Docker Desktop app for Mac, but it won't launch the newer Docker Desktop app for Mac for Apple Silicon v4.25.0, as when it is copying over, I get a message from Mac OS saying "Docker.app is damaged and cannot be opened. You should move it to the trash," with two buttons, "Move to Trash" and "Cancel." What makes matters worse, is this dialogue will not go away, no matter how long I hold down the Escape key to do the "Cancel," and will only go away once I've moved the new Docker Desktop app for Mac for Apple Silicon v4.25.0 to the trash. I cannot move it out of the trash, as the moment I try, I immediately get the "Docker.app is damaged and cannot be opened. You should move it to the trash," with the two buttons, "Move to Trash" and "Cancel" again, over and over.

I have tried the following to resolve they and get the newer Docker Desktop app for Mac for Apple Silicon v4.25.0 installed on my MacBook Air, as I need immediately it for my work and development projects —

Obviously, I'm frustrated and at a loss for what to do here — I cannot be without Docker, my work / projects require I use that and some kubernetes stuff on AWS (AWS ECS Fargate & AWS EKS) so I cannot be without Docker and I have had this problem since last night. If someone could please tell me how I can properly download the latest Docker Desktop app for Mac for Apple Silicon v4.25.0 on my MacBook Air and have it install properly with no errors, I would greatly appreciate it. Thank you in advance.

rorylinehan-agora commented 10 months ago

@faddah If it helps, I fixed mine by downgrading to Docker desktop 4.24.2

almunnings commented 10 months ago

Same thing happened to me, Normal auto-update of docker, ☠️

@faddah and I have had some luck re-installing rosetta, before installing docker.

Perhaps there is a hint in the response from installing rosetta:

2023-11-20 09:14:43.214 softwareupdate[2655:6978809] Package Authoring Error: 042-86463: Package reference com.apple.pkg.RosettaUpdateAuto is missing installKBytes attribute

Try: softwareupdate --install-rosetta

Then re-drag-dropping the app into your Applications from the download dmg.

Seemed to work after that. No idea why.

neonima commented 10 months ago

Hey there @aroc, would you be able to try what @almunnings suggested is working?

Can you also make sure @aroc you have your time system correctly synced? System Settings > Date and Time I've seen some users having this problem on other apps where the system time didn't match the created time of the signed DMG which can "confuse" gatekeeper

Thank you very much everyone for the investigation, that's really insightful - I am currently investigating how this problem is happening and how it could relate to rosetta 2

faddah commented 10 months ago

Actually, through @almunnings on the Docker Slack in the #docker-desktop-mac channel, i was finally able to get help and get this fixed. What @almunnings did was, from the Mac OS Terminal command line, he did $ softwareupdate --install-rosetta, and then downloaded the latest Docker Desktop for Mac v4.25.1 for Apple Silicon chip, copied that new version over, and it seemed to work without the dreaded, "'Docker' is damaged and can't be opened. You should move it to the Trash." error. I did the same, and it is now working for me also.

However, I think this ticket needs to remain open, because Rosetta is for emulating / virtualizing Mac OS Apps that were created for Intel chip byte code, not the current Apple Silicon M1, M2 or M3 family chipset. There is no reason, if, as it purports to be, the Docker Desktop for Mac v4.25.1 for Apple Silicon is solely for Apple Silicon Macs, there should be no Rosetta or previous Intel emulation / virtualization needed. But that is the fix. So I think the Docker engineering team needs to really look at this and figure out why their Apple Silicon software download requires Rosetta emulations / virtualization to run properly.

netopsengineer commented 10 months ago

This happened to me also but on Intel Mac, this is the second time in about a year, and seemingly related to updating but not immediately after, usually after a reboot and the login item for Docker tries to start and it's a wrap. Latest Sonoma update, latest Docker Desktop, I've just finished uninstalling and about to reinstall but this requires deleting volumes and essentially losing everything related to Docker.

MaximGns commented 9 months ago

@almunnings Thanks for sharing this info, this made it work indeed!

jwilliams-fn commented 9 months ago

I was still getting this after running:

softwareupdate --install-rosetta

So I ended up copying Docker.app out of the .dmg and into my Downloads folder and then manually moving it to my applications directory with:

mv ~/Downloads/Docker.app /Applications/

For whatever reason that seemed to work.

brianmriley commented 9 months ago

I was able to fix this with some help from a brew install after trying the following:

On a hunch I decided to try reinstalling with brew brew install --cask docker , which provided me more detailed errors like:

% brew install --cask docker
==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-cask/d466e6742ea09040fa9bcecd2d07e1f592020cc0/Casks/d/docker.rb
###################################################################################################################################################################### 100.0%
==> Downloading https://desktop.docker.com/mac/main/arm64/131620/Docker.dmg
###################################################################################################################################################################### 100.0%
==> Installing Cask docker
==> Moving App 'Docker.app' to '/Applications/Docker.app'
==> Backing App 'Docker.app' up to '/opt/homebrew/Caskroom/docker/4.26.1,131620/Docker.app'
==> Removing App '/Applications/Docker.app'
==> Purging files for version 4.26.1,131620 of Cask docker
Error: It seems there is already a Binary at '/usr/local/bin/docker'.

I asked chat what this meant and it responded with:

The error message you're seeing, Error: It seems there is already a Binary at '/usr/local/bin/docker', suggests that a Docker binary already exists on your system, likely from a previous installation. This is preventing Homebrew from completing the installation process. Here's how you can resolve this:

Remove the Existing Docker Binary:

Before proceeding, it’s important to remove the existing Docker binary. Use the following command:
bash
Copy code
sudo rm /usr/local/bin/docker
This command will remove the existing Docker binary. You may need to enter your password.
Reinstall Docker Using Homebrew:

After removing the existing binary, you can try reinstalling Docker with Homebrew. Run the command again:
bash
Copy code
brew install --cask docker
This should now complete without the error.

When I tried to install via brew a second time I received a similar error, so I asked chat again and it said to do the same for the new docker artifact that stuck around...rinse and repeated this until these errors were gone and voila, was able to install and run Docker Desktop again.

ericls commented 8 months ago

Looks like something (likely something watching the Applications folder or on a schedule) is trying to start Docker before the copying is finished... I manually closed the "verifying..." dialog that pops up a few times during the copying process and that seems to do the trick.

brianhogg commented 8 months ago

I hit this yesterday when I tried to re-run Docker after upgrading from an Intel-based mac. After uninstalling the old Docker application, I needed to do a full system restart before I was able to install the new Apple Chip version.

Minotti commented 8 months ago

Hello there, i was the same error, but i you guys can fix with some steps.

  1. Uninstall docker (move to trash) as the image says.
  2. Update MacOS
  3. Install Docker dmg

It's works for me right now.

neonima commented 8 months ago

Updates from any version to 4.27.1 fixed some problems during the update process including cases where corruptions could happen. We would love your feedback and see if you encounter this issue going forward (to and from 4.27.1)

Feel free to @ me in this thread if you experience this again!

https://docs.docker.com/desktop/release-notes/#4271

reeversedev2 commented 8 months ago

I had the same issue. I tried installing it binary and it always failed saying that, Docker is damaged and can't be opened. I then tried to install it with brew. While installing with brew as well, I faced errors but they were related to already existing files required for docker to be installed completely.

So, I deleted those files and tried again and it worked! 🎉

These are the files that I deleted:

- /usr/local/bin/docker
- /usr/local/bin/docker-compose
- /usr/local/bin/docker-credential-desktop
- /usr/local/bin/docker-credential-ecr-login
- /usr/local/bin/docker-credential-osxkeychain
- /usr/local/bin/docker-index
- /usr/local/bin/kubectl.docker
- /usr/local/bin/com.docker.cli
- /usr/local/bin/hub-tool
neonima commented 8 months ago

@reeversedev2 thank you for the feedback, would you be able to indicate me from which version of Docker Desktop you initiated the update and with which version you ended up after the update? I'm glad you were able to unblock yourself 🚀

KStone18 commented 8 months ago

Thank you for the feedback, I've tried these steps and still have this issue within 30 mins of a fresh install... Here is my environment setup, OS - Sonoma 14.3, Intel cpu. I have tried all the versions below

4.26.0 4.26.1

Steps I took until corruption. 1.) uninstalled docker manually 2.) removed all the listed above files
3.) reinstalled through the DMG from docker.com 4.) waited 30 mins and the error appeared.

Note: other times I get the error immediately after reinstall.

neonima commented 8 months ago

Hey there would you be able to try again with the latest version (4.27.1)? https://docs.docker.com/desktop/release-notes/#4271 most of corruption would be fixed from this version :) let me know how it goes!

KStone18 commented 8 months ago

@neonima Yep I've been trying on the newest version and was able to get it installed and it worked however, docker-compose is now showing as corrupted..

note the docker compose version I'm using is this one.. [docker-compose-darwin-x86_64] (https://github.com/docker/compose/releases/download/v2.24.5/docker-compose-darwin-x86_64) image

reeversedev2 commented 8 months ago

@neonima I updated to v4.27.1 from v4.27.0. However, I think my issue was more of a update not installed properly.

neonima commented 7 months ago

@reeversedev2 Thank you 👍 I am curious to see how the futur updates will work for you after you've cleaned the binaries from the dir!

@KStone18 If I understand you correctly you've installed docker compose outside of the docker.dmg package, and when you did the update from the app, docker compose got corrupted, am I correct? Note: docker-compose gets installed with docker desktop, but if you need to use a specific version, it shouldn't create a corruption on an already installed binary. Would you be able to send me a Diag ID? https://docs.docker.com/desktop/troubleshoot/overview/#diagnose-from-the-terminal Thanks a lot!

eusden commented 7 months ago

I ran into this issue as well just now upgrading to Sonoma 14.3.1, then Docker complained with the message in thread.

Thanks to @brianmriley 's comment it's now resolved.

Steps I took:

  1. Move to Trash after initial error message.
  2. Reinstalled Docker Desktop Apple Chip 4.27.2 from https://docs.docker.com/desktop/install/mac-install/
  3. Still saw the error. Move to Trash again.
  4. Ran on terminal brew install --cask docker; same error message as Brian saw.
  5. Removed files as noted by @reeversedev2 :
- /usr/local/bin/docker
- /usr/local/bin/docker-compose
- /usr/local/bin/docker-credential-desktop
- /usr/local/bin/docker-credential-ecr-login
- /usr/local/bin/docker-credential-osxkeychain
- /usr/local/bin/docker-index
- /usr/local/bin/kubectl.docker
- /usr/local/bin/com.docker.cli
- /usr/local/bin/hub-tool
  1. Restarted
  2. Same error when installing from Docker Desktop again.
  3. Installed via terminal again with brew install --cask docker
  4. Docker Desktop launches successfully.
StefanieBondzio commented 7 months ago

Same here on Mac with Apple Chip and Sonoma and Docker Version 4.27.2 followed the steps from @brianmriley (the hard way) and succeeded

jagobagascon commented 7 months ago

This happens to me every few months. To fix it I just uninstall docker, restart the Mac, and install it again. Works every time.

neonima commented 7 months ago

@jagobagascon would you be able to send me a diag id?

danielvdp commented 7 months ago

This just occurred for me in the Docker app on Mac Apple M1 Sonoma 14.3 conducting a recommended update to Docker 4.28.0 (I was up to date with all the updates up to this point). I suppose there are no options to recover anything an a clean install is required?

Update: can continue using Docker after giving permission in system settings -> security preferences.

jagobagascon commented 7 months ago

@neonima sorry for the wait. Here it is: 1A7FB959-8001-49F2-8969-CEB679979E39/20240305163955.

neonima commented 7 months ago

Thank you very much!

jagobagascon commented 6 months ago

It just happened again. I had a few containers running and had to leave for half an hour. When I got back and woke up the Mac the error was showing:

“Docker.app” is damaged and can’t be opened.

And I'm quite sure that every time this has happened it was the same situation. Mac sleeps with docker running, the error shows on wake up.

Edit: I forgot to mention (and this may be important) that I install Docker using the Mosyle MDM client for business.

ah3243 commented 6 months ago

I had the same issue. I tried installing it binary and it always failed saying that, Docker is damaged and can't be opened. I then tried to install it with brew. While installing with brew as well, I faced errors but they were related to already existing files required for docker to be installed completely.

So, I deleted those files and tried again and it worked! 🎉

These are the files that I deleted:

- /usr/local/bin/docker
- /usr/local/bin/docker-compose
- /usr/local/bin/docker-credential-desktop
- /usr/local/bin/docker-credential-ecr-login
- /usr/local/bin/docker-credential-osxkeychain
- /usr/local/bin/docker-index
- /usr/local/bin/kubectl.docker
- /usr/local/bin/com.docker.cli
- /usr/local/bin/hub-tool

solution worked for me!

evb-final commented 5 months ago

I got the same error after updating Docker Desktop. The simple solution that worked for me was: right-click the Docker app in finder (Macintosh HD > Apps> Docker) and choose 'Open' in the dialog.

arookieds commented 5 months ago

I am having the same issue now and then (maybe a couple of times per month). I am not sure if each time was related to the mac sleeping. But this time, I was working on my mac, and suddenly got this message. It is not the first time I got this message while working on the mac. Every time, I needed to reinstall Docker.

Screenshot 2024-05-07 at 22 13 50
elaman commented 5 months ago

I just had this issue. Went about debugging it:

  1. Check the logs using the "Console" + filter logs by "docker". Found this issue:

    ASP: Security policy would not allow process: 1494, /Applications/Docker.app/Contents/Library/LoginItems/DockerHelper.app/Contents/MacOS/DockerHelper

  2. Went to Security settings for OSX. And found this warning:

    Screenshot 2024-05-08 at 13 01 52

So in my understanding, what happens is at some point Docker stops being treated as "Identified developer", then tries to auto-open its helper apps, at which point we get this cryptic message.

At this point I'll try to just reinstall it, but I'm curious as to what caused this issue. Why docker is not identified developer.

neonima commented 5 months ago

Docker being marked as damaged due to symlinks being used at the same time an in-update is happening has been fixed! Please open a new issue if this arises again from 4.30

@elaman Would you be able to open a new issue - this looks different :)

doylio commented 5 months ago

I managed to fix this by doing the following:

  1. Uninstall docker
  2. Run brew cleanup docker
  3. Remove the leftover files that @reeversedev2 mentioned (I used sudo rm /usr/local/bin/*{docker,kubectl,hub-tool}* to do so)
  4. Remove Docker from the Login Items. (System Settings > General > Login Items and remove "Docker" from the list at the top)
  5. Empty Trash bin (sometimes a Docker Helper would start up from the Trash)
  6. Logout & back in
  7. Install fresh copy of Docker
strogonoff commented 4 months ago

Just happened again after update today.

neonima commented 4 months ago

Hey @strogonoff Would you be able to share from which version you did an update or was it a manual update? Thanks :)

@doylio this is now fixed in the latest version with in-app update, however if you update manually, it might still happen

hungvietdo commented 2 months ago

Version 2.42.2 works for me

danbeaumont95 commented 2 months ago

Just re-downloading it manually from docker website fixed this for me - I'm on 4.32.0 ☝️

israrwz commented 2 months ago

my solution was:

first move the Docker app to trash when you see the dialog. Then reopen the .dmg file and drag it to the Applications folder but DON'T open the app.

before opening the Docker.app when it's added to the Applications folder. Go to System Settings > Privacy & Security > Developer Tools click the + icon and Docker.app from the Applications folder. Now you should be able to open Docker.

This seem to have solved the issue.

janparttimaa commented 2 months ago

I am trying to deploy Docker Desktop 4.32.0 DMG-file via Microsoft Intune to managed Mac-devices and I am also facing reported issues. When Docker Desktop have been installed from Company Portal, users will get this:

Screenshot 2024-08-09 at 13 46 04

After that, users need to manually delete the app so Intune will re-install it again. For some users, that works. For some other users, it does not.

We have also identified this from Gatekeeper, which also prevent some users to open Docker from Launchpad:

Screenshot 2024-08-06 at 12 14 47

Anyone else still facing these issues from latest version? This version is not ready for Intune-deployment due to these problems.

tai-sho commented 1 month ago

I am using a MacBook Pro M1, and I was experiencing the same issue. However, the method provided by @israrwz worked without any problems.

my solution was:

first move the Docker app to trash when you see the dialog. Then reopen the .dmg file and drag it to the Applications folder but DON'T open the app.

before opening the Docker.app when it's added to the Applications folder. Go to System Settings > Privacy & Security > Developer Tools click the + icon and Docker.app from the Applications folder. Now you should be able to open Docker.

This seem to have solved the issue.

SamuelBanya commented 1 month ago

The only thing that worked for me is that I installed Docker Desktop for M1 Silicon Chip once and got the same initial message as OP.

I then redownloaded the installer, ran it again, and told it to replace it. For some reason, that allowed this to work.

Using the latest MacOS Sonoma with an M1 Mac.