My question is
How to easily install docker to have it available in terminal and how to uninstall docker on osx?
To Install:
To Uninstall:
/Applications/Docker.app/Contents/MacOS/Docker --uninstall
is much nice if it functions.
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).
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
sudo rm -Rf ~/Library/Group\ Containers/group.com.docker
freed up 30GB of space on my machine!
Commented
Apr 21, 2021 at 20:11
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
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
brew cask install
was deleted. Instead use brew install --cask docker
Commented
Jan 6, 2021 at 18:49
/Applications/Docker
has become /Applications/Docker.app
for uninstalltion. Thank you for sharing this solutiuon!
To install: brew install --cask docker
To uninstall: brew uninstall --cask docker
After following the uninstall step in Cerniuk's excellent answer, I found that I still had some files remaining on my MacOS Sonoma 14.1.1 that could be deleted:
sudo rm -Rfv /usr/local/bin/docker-index
sudo rm -Rfv /private/var/run/docker.sock
sudo rm -Rfv /private/var/root/Library/Containers/com.docker.docker
sudo rm -Rfv /Library/PrivilegedHelperTools/com.docker.socket
sudo rm -Rfv /Library/Logs/DiagnosticReports/com.docker.backend_*
sudo rm -Rfv /Library/LaunchDaemons/com.docker.socket.plist
sudo rm -Rfv ~/Library/Application Support/com.bugsnag.Bugsnag/com.docker.docker
sudo rm -Rfv ~/Library/Saved Application State/com.electron.dockerdesktop.savedState
sudo rm -Rfv ~/Library/Preferences/com.electron.dockerdesktop.plist
sudo rm -Rfv ~/Library/HTTPStorages/com.docker.docker
sudo rm -Rfv ~/Library/Application Scripts/group.com.docker
sudo rm -Rfv ~/Library/Caches/Docker\ Desktop
sudo rm -Rfv ~/Library/Caches/docker-compose
sudo rm -Rfv ~/Library/Caches/com.docker.docker