Post

How to Clean Up Docker on macOS

Clean out Docker containers, images, and volumes on macOS for a fresh start.

How to Clean Up Docker on macOS

When Docker takes up too much space or misbehaves, a complete cleanup can be the easiest way to start fresh. Follow these steps to remove all Docker data from your Mac and reinstall Docker Desktop if needed.

1. Remove Containers, Images, and Volumes

Open Terminal and run these commands to delete everything:

  • Remove all containers
    1
    
    docker rm -f $(docker ps -a -q)
    
  • Remove all images
    1
    
    docker rmi -f $(docker images -a -q)
    
  • Remove all volumes
    1
    
    docker volume rm $(docker volume ls -q)
    

These commands permanently delete all existing Docker resources, so back up anything important first.

2. Uninstall Docker Desktop

You can uninstall from the app or via Terminal:

  • From the Docker Desktop app
    • Open Docker Desktop and click the bug icon.
    • Choose Uninstall and confirm.
  • From Terminal
    1
    
    /Applications/Docker.app/Contents/MacOS/uninstall
    

    If you see an “operation not permitted” message, you can ignore it.

3. Remove Leftover Files

Delete the residual Docker folders to ensure nothing remains:

1
2
3
4
5
6
7
rm -rf ~/Library/Group\ Containers/group.com.docker
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/Caches/Docker\ Desktop

If you run into permission errors, grant Terminal Full Disk Access in System Settings → Privacy & Security.

4. Optional: Use a Third-Party Uninstaller

Tools like CleanMyMac or App Cleaner & Uninstaller can automatically remove Docker files, including hidden caches and logs.

5. Reinstall Docker Desktop

Download the latest Docker Desktop for Mac from the official website and install it as usual by dragging the app into Applications.

After installation, Docker should start with no previous containers, images, or volumes. You now have a clean slate for your development environment.


Summary of Key Commands

TaskCommand
Remove all containersdocker rm -f $(docker ps -a -q)
Remove all imagesdocker rmi -f $(docker images -a -q)
Remove all volumesdocker volume rm $(docker volume ls -q)
Uninstall Docker Desktop/Applications/Docker.app/Contents/MacOS/uninstall
Remove Docker leftoversSee leftover file commands above

This procedure removes all Docker components from your Mac, letting you reinstall or update Docker Desktop cleanly.

☕ Support My Work

If you found this post helpful and want to support more content like this, you can buy me a coffee!

Your support helps me continue creating useful articles and tips for fellow developers. Thank you! 🙏

This post is licensed under CC BY 4.0 by the author.