Unable to restart and remove Docker from Applications in Mac : Fatal Error failed to ping backend api

Viewed 18325

I suddenly got the fatal error message from Docker yesterday. I really don't understand why as I shut down my machine properly. So I decided to uninstall docker and reinstall it. I went into the Applications folder in my Mac and I can't uninstall because it thinks the docker is open. So I need help with the following:

  1. how do I uninstall docker?
  2. how do I install it so it can start working again?

Attempts at a resolution:

Just tried the following command in my terminal:

docker kill $(docker ps -q)

I got the following response:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
"docker kill" requires at least 1 argument.
See 'docker kill --help'.

What do I do?

See the screen shot

enter image description here

6 Answers

1- open Activity monitor and go to com.docker. process , from there you have to kill it to proceed further.

2- uninstall from mac is standard procedure.

enter image description here

This was getting me crazy.

enter image description here

You don't need to reinstall Docker to solve it. The workaround (at least in my case) is as simple as killing all Docker related processes and running Docker again:

$ pkill Docker

$ open -a /Applications/Docker.app

In my case I was not able to use the Option of Rest and Diagnose too. UI was completely hung

Here's how I solved it.

  1. Killed the docker process $ pkill Docker
  2. Moved the docker application to bin
  3. Manually deleted all the below files
    • sudo rm -rf /usr/local/lib/Docker
    • sudo rm -rf /Library/PrivilegedHelperTools/com.docker.vmnetd
    • sudo rm -rf /Library/LaunchDaemons/com.docker.vmnetd.plist
    • rm -rf ~/.docker
    • rm -rf ~/Library/Containers/com.docker.docker
    • rm -rf ~/Library/Application Support/Docker Desktop
    • rm -rf ~/Library/Preferences/com.docker.docker.plist
    • rm -rf ~/Library/Saved Application State/com.electron.docker-frontend.savedState
    • rm -rf ~/Library/Group Containers/group.com.docker
    • rm -rf ~/Library/Logs/Docker Desktop
    • rm -rf ~/Library/Preferences/com.electron.docker-frontend.plist
    • rm -rf ~/Library/Cookies/com.docker.docker.binarycookies
  4. Restarted the laptop
  5. Installed the latest version again which worked fine

Ok, I was able to fix this problem. You can do this with ANY application (just change the name), that you can't remove from the applications folder.

It will remove the entire application in its entirety. The existence of the application is wiped clean.

Please do the following commands in this order

  1. ps aux | grep docker

When you run this command you get a big display. You are only interested in the following thing in the his screen grab

enter image description here

2 Then do a sudo kill command that includes the number in the red box from the ps aux|grep command as shown this code example in step 1.

sudo kill -9 108
  1. Finally go to sudo remove command specifying the specific folder and application you want to remove.

    sudo rm -rf /Applications/Docker.app/

  2. Restart your machine.

  3. Install version of docker. If the error occurred when updating to a new version of docker (such as in my case). You can download an older version of docker from here (the older version numbers are listed in the far left). I chose 3.3.0 (released 04/21 installed 6/11/21

Note: If you have a problem installing an older version of docker and you encounter a problem enter image description here

  1. Run the following command and you will see a .json display

    vi ~/Library/"Group Containers"/group.com.docker/settings.json

Scroll down to settings and modify the version down. For 3.3.0 I went down to setting version 7.

  1. Restart docker and when it opens check images and you can see your containers

I'm facing this error for docker version 3.6.0. then reinstall docker version 4.1.1 and it's working fine.

Related