How to easily install and uninstall docker on MacOs

My question is

How to easily install docker to have it available in terminal and how to uninstall docker on osx?


To Install:

  1. Go Here
  2. Click the "Get Docker" or "Get Docker Desktop for Mac (Stable)" button.
  3. Double-click the DMG
  4. Drag Docker into Applications
  5. Open Docker
  6. Open Terminal after install and docker will be available. Docker should auto-launch on subsequent startups and be available on command line.

To Uninstall:

  1. Click On Docker Icon
  2. Select Preferences
  3. Select Bug Icon for the Troubleshoot menu (Bomb Icon in older Docker UI)
  4. Select Uninstall

An image of Troubleshoot menu that includes Uninstall button


Install

To install Docker is easy. Download the .dmg, open it, drag and drop the Docker app to Applications, then run Docker Desktop for Mac. Unfortunately, it sprawls gunk all over your Mac (see uninstall).

Uninstall

If Docker starts, you can use the Docker Desktop app to uninstall. If that doesn't work, you will have to dive into the command line. For a complete uninstall as of 27-Dec-2020, type the following into the terminal:

(Be aware, this removes any Docker virtual machines and images too!)

sudo rm -Rf /Applications/Docker.app
sudo rm -f /usr/local/bin/docker
sudo rm -f /usr/local/bin/docker-machine
sudo rm -f /usr/local/bin/com.docker.cli
sudo rm -f /usr/local/bin/docker-compose
sudo rm -f /usr/local/bin/docker-compose-v1
sudo rm -f /usr/local/bin/docker-credential-desktop
sudo rm -f /usr/local/bin/docker-credential-ecr-login
sudo rm -f /usr/local/bin/docker-credential-osxkeychain
sudo rm -f /usr/local/bin/hub-tool
sudo rm -f /usr/local/bin/hyperkit
sudo rm -f /usr/local/bin/kubectl.docker
sudo rm -f /usr/local/bin/vpnkit
sudo rm -Rf ~/.docker
sudo rm -Rf ~/Library/Containers/com.docker.docker
sudo rm -Rf ~/Library/Application\ Support/Docker\ Desktop
sudo rm -Rf ~/Library/Group\ Containers/group.com.docker
sudo rm -f ~/Library/HTTPStorages/com.docker.docker.binarycookies
sudo rm -f /Library/PrivilegedHelperTools/com.docker.vmnetd
sudo rm -f /Library/LaunchDaemons/com.docker.vmnetd.plist
sudo rm -Rf ~/Library/Logs/Docker\ Desktop
sudo rm -Rf /usr/local/lib/docker
sudo rm -f ~/Library/Preferences/com.docker.docker.plist
sudo rm -Rf ~/Library/Saved\ Application\ State/com.electron.docker-frontend.savedState
sudo rm -f ~/Library/Preferences/com.electron.docker-frontend.plist

By command line

INSTALL

First install cask by type in terminal

brew tap phinze/homebrew-cask
brew install brew-cask

and then type:

brew cask install docker

And run docker by

open /Applications/Docker.app

(or by macOs bottom menu> launchpad > docker - on first run docker will ask you about password)

Thats all :)

UNINSTALL

Type brew cask uninstall docker

  • thats all :)

To clean everything (including images/containers) execute below commands:

sudo rm -Rf /Applications/Docker
sudo rm -f /usr/local/bin/docker
sudo rm -f /usr/local/bin/docker-machine
sudo rm -f /usr/local/bin/docker-compose
sudo rm -f /usr/local/bin/docker-credential-osxkeychain
sudo rm -Rf ~/.docker
sudo rm -Rf $HOME/Library/Containers/com.docker.docker  # here we delete stored images

To install: brew install --cask docker

To uninstall: brew uninstall --cask docker