214

My question is

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

Kamil Kiełczewski
  • 85,173
  • 29
  • 368
  • 345

4 Answers4

337

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

BrDaHa
  • 5,138
  • 5
  • 32
  • 47
Cynic
  • 6,779
  • 2
  • 30
  • 49
  • 22
    Beware: this approach uninstalls all images & containers. I had installed Docker using Homebrew and also the desktop app, thinking that removing the latter would preserve my images. Alas! – kip2 Oct 26 '20 at 19:08
  • 2
    There is now an option to uninstall from the command line, this might work if the UI is not in a state where you can uninstall from the GUI: https://docs.docker.com/desktop/install/mac-install/#uninstall-docker-desktop – BrDaHa Aug 23 '22 at 18:44
  • agree with @kip2, this will remove all docker installations and containers – GvSharma Aug 25 '22 at 10:39
  • 1
    @BrDaHa That page contains no information on uninstalling. – Andrew Oct 09 '22 at 21:15
  • @Andrew because it was moved in https://github.com/docker/docs/commit/92e8a41c8ef014da5fce5f344b88435fd611b1af. Moved here: https://docs.docker.com/desktop/uninstall/ – BrDaHa Oct 14 '22 at 04:34
  • 2
    Thanks. Updating the link would be fine, but its nice to have the commit hash that did the work, for posterity. I had to manually delete everything since the UI didn't work, but `/Applications/Docker.app/Contents/MacOS/Docker --uninstall` is much nice if it functions. – Andrew Oct 14 '22 at 13:16
206

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
kenny_k
  • 3,831
  • 5
  • 30
  • 41
Cerniuk
  • 14,220
  • 2
  • 29
  • 27
  • 18
    the command line steps work and they're pretty helpful if for some reason your docker app WON'T start up (normally your docker app should automatic start at Mac boot up and you can invoke the docker desktop and select UNINSTALL). – punsoca Mar 06 '21 at 02:09
  • I have a question - which sudo rm can we SKIP to retain the containers? I assume just skip `sudo rm -Rf ~/Library/Group\ Containers/group.com.docker` or just backup that folder and copy it back after successful docker re-install? – punsoca Mar 06 '21 at 02:12
  • 4
    Thanks so much. Running `sudo rm -Rf ~/Library/Group\ Containers/group.com.docker` freed up 30GB of space on my machine! – Chris Houghton Apr 21 '21 at 20:11
  • 8
    Thanks for the uninstall commands. Like many people probably, I only ended up here because my docker app become completely unresponsive, so I can't have it remove itself. – Scott Smith Jun 23 '21 at 19:35
  • I'm not sure what to leave to retain your data but Chris Houghton 's comment would suggest the /Containers, confirming your comment @punsoca – Cerniuk Jul 30 '21 at 14:18
  • 3
    @Cerniuk works flawlessly! – Gaurav Oct 20 '21 at 11:19
  • 5
    When I update to MacOS 12 (Monterey) Docker Desktop crashed every time. I tried to uninstall and downgrade with any success. With this uninstall now I have Docker again, thanks! – Joan Galmés Riera Oct 29 '21 at 11:54
  • 1
    Thx mate - you saved my day. Your uninstall commands brought my docker back to life! After upgrading to MacOS 12.2 (Monterey), docker just displayed as "not responding" at activity monitor, but now everything works great again! – WhatzzUp Jan 27 '22 at 13:49
  • 1
    I got a "“com.docker.vmnetd” is an app downloaded from the Internet. Are you sure you want to open it?" dialog every time I logged into my computer despite not having Docker.app installed and your `rm` commands fixed that. – Boris Verkhovskiy Mar 24 '22 at 06:50
  • 2
    After switching to an experimental feature (VirtioFS) which broke my Docker in March 2022 on MacOS 12.2.1 this was the only answer which really helped. Thanks! – sladomic Mar 30 '22 at 18:01
  • 1
    Sadly, this is still the only reliable way to uninstall a broken Docker. https://github.com/docker/for-mac/issues/6519 – BrDaHa Oct 14 '22 at 05:00
108

By command line

INSTALL

Install with

brew install --cask 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 uninstall --cask 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
Jason Schilling
  • 475
  • 6
  • 19
Kamil Kiełczewski
  • 85,173
  • 29
  • 368
  • 345
  • 2
    Try also: ```brew cask zap docker``` – Gary S. Weaver Feb 07 '19 at 11:17
  • I like this answer for the most part, but having trouble: brew install brew-cask Error: No available formula with the name "brew-cask" – Marcus Apr 25 '19 at 20:18
  • @Marcus may be this will help: https://github.com/Homebrew/homebrew-cask/issues/6179 – Kamil Kiełczewski Apr 25 '19 at 20:31
  • First line should be sudo rm -Rf /Applications/Docker.app – Stefan Schultze Jan 02 '21 at 11:53
  • 13
    As of Homebrew 2.7, `brew cask install` was deleted. Instead use `brew install --cask docker` – JSchirrmacher Jan 06 '21 at 18:49
  • 3
    As of April 2021, `/Applications/Docker` has become `/Applications/Docker.app` for uninstalltion. Thank you for sharing this solutiuon! – Hiroki Apr 14 '21 at 16:09
  • It's bizarre how horribly bad Docker has become, it's unuseable and after each little update literally every company I work for is down. 70 developers cannot work, all systems need to be rebuilt, nobody has a clue. From excellent game-changing tool to corporate crap in just a few years, well done! Maybe we look for an alternative? – Sliq Mar 17 '22 at 11:47
20

To install: brew install --cask docker

To uninstall: brew uninstall --cask docker

theyCallMeJun
  • 911
  • 1
  • 10
  • 21