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

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

Open aroc opened this issue 2 years ago • 31 comments

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.

aroc avatar Oct 27 '23 14:10 aroc

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

rorylinehan-agora avatar Nov 03 '23 17:11 rorylinehan-agora

+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 —

  • 2022 MacBook Air
  • Apple M2 chip running @ 3.48 GHz
  • 24 GB of RAM
  • MacOS Sonoma v14.1.1

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 —

  • I have tried re-starting (power cycling) the MacBook Air, several times, and then re-downloading the Apple Silicon installer for Docker Desktop for the Mac OS (https://www.docker.com/get-started/ -or- https://docs.docker.com/get-docker/ -or- https://docs.docker.com/desktop/install/mac-install/). I get the same result of getting the Mac OS dialogue telling me the Docker.app is damaged and must be moved to the trash.
  • Again, I have restarted the MacBook Air and deleted all previous *.dmg Docker install images and re-downloaded them again from the sites I referenced above, and I still get the same result of getting the Mac OS dialogue telling me the Docker.app is damaged and must be moved to the trash.
  • I read in the Docker Community Forums this post 👉 https://forums.docker.com/t/docker-desktop-update-deleted-the-app/138439, where one of the responders to the post said to go to ls -lahs ~/Library/Containers/com.docker.docker/Data/vms/0/data and if the Docker.raw file is there, delete. I did so, and restarted my MacBook air, re-downloaded a new Docker Desktop app for Mac for Apple Silicon v4.25.0 install *.dmg file, and tried copying Docker Desktop app for Mac for Apple Silicon v4.25.0 to my MacBook Air Applications folder, and still get the same result of getting the Mac OS dialogue telling me the Docker.app is damaged and must be moved to the trash.
  • I have also tried deleting from my ~/Library/Containers/com.docker.docker and ~/Library/Containers/com.docker.helper directories completely, as well as searching for and deleting any other com.docker.* directories or files and any docker-related *.plist files, restarting the MacBook Air and re-downloading the install dmg files for Docker Desktop app v4.25.0 for Apple Silicon and reinstalling, and I still get the same result of getting the Mac OS dialogue telling me the Docker.app is damaged and must be moved to the trash.
  • I have also seen this recently opened Issue here on the GitHub Docker for Mac repository, Issue #7046, that states this problem also that is still open and has not been addressed 👉 https://github.com/docker/for-mac/issues/7046.

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.

faddah avatar Nov 16 '23 00:11 faddah

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

rorylinehan-agora avatar Nov 16 '23 14:11 rorylinehan-agora

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.

almunnings avatar Nov 20 '23 00:11 almunnings

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

neonima avatar Nov 20 '23 17:11 neonima

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.

faddah avatar Nov 21 '23 01:11 faddah

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.

netopsengineer avatar Nov 25 '23 23:11 netopsengineer

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

MaximGns avatar Jan 01 '24 14:01 MaximGns

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.

jwilliams-fn avatar Jan 09 '24 19:01 jwilliams-fn

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

  • Upgrade Docker Desktop to next version...got stuck overnight.
  • Uninstalled.
  • Tried to reinstall with "Docker is damaged and can't be opened" error

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.

brianmriley avatar Jan 10 '24 20:01 brianmriley

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.

ericls avatar Jan 18 '24 06:01 ericls

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.

brianhogg avatar Jan 19 '24 15:01 brianhogg

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.

Minotti avatar Jan 27 '24 16:01 Minotti

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

neonima avatar Feb 03 '24 16:02 neonima

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

reeversedev2 avatar Feb 05 '24 15:02 reeversedev2

@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 🚀

neonima avatar Feb 05 '24 17:02 neonima

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.

KStone18 avatar Feb 05 '24 21:02 KStone18

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!

neonima avatar Feb 05 '24 22:02 neonima

@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

KStone18 avatar Feb 05 '24 23:02 KStone18

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

reeversedev2 avatar Feb 06 '24 10:02 reeversedev2

@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!

neonima avatar Feb 15 '24 01:02 neonima

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.

eusden avatar Feb 15 '24 14:02 eusden

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

StefanieBondzio avatar Feb 16 '24 11:02 StefanieBondzio

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

jagobagascon avatar Feb 20 '24 07:02 jagobagascon

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

neonima avatar Feb 26 '24 19:02 neonima

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.

danielvdp avatar Mar 05 '24 12:03 danielvdp

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

jagobagascon avatar Mar 05 '24 16:03 jagobagascon

Thank you very much!

neonima avatar Mar 06 '24 21:03 neonima

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.

jagobagascon avatar Apr 09 '24 14:04 jagobagascon

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!

ah3243 avatar Apr 12 '24 01:04 ah3243