How to easily install and uninstall Docker on macOS

Learn how to easily install and uninstall docker on macos with practical examples, diagrams, and best practices. Covers macos, docker development techniques with visual explanations.

Effortless Docker Management on macOS: Install and Uninstall Guide

Hero image for How to easily install and uninstall Docker on macOS

Learn how to seamlessly install and completely remove Docker Desktop from your macOS system, ensuring a clean setup or removal.

Docker has become an indispensable tool for developers, enabling them to build, ship, and run applications in isolated environments. This guide provides a comprehensive walkthrough for installing Docker Desktop on macOS, covering both the initial setup and the process for a clean uninstallation, should you need to remove it entirely. We'll explore the recommended methods and common pitfalls to ensure a smooth experience.

Understanding Docker Desktop for macOS

Docker Desktop is the easiest way to get started with Docker on your Mac. It includes Docker Engine, Docker CLI client, Docker Compose, Kubernetes, and Credential Helper. It leverages macOS virtualization technologies (Hypervisor.framework) to run a lightweight Linux VM, which hosts the Docker daemon. This integration makes it feel like Docker is running natively on your Mac.

flowchart TD
    A[User on macOS] --> B{Docker Desktop Installation}
    B --> C[Downloads .dmg file]
    C --> D[Drags to Applications Folder]
    D --> E[Launches Docker Desktop]
    E --> F[Initial Setup & Permissions]
    F --> G[Docker Engine Running in VM]
    G --> H[Docker CLI Available]
    H --> I[Ready to use Docker]

High-level Docker Desktop installation process on macOS

Installing Docker Desktop on macOS

The installation process for Docker Desktop on macOS is straightforward and typically involves downloading an installer package and dragging the application to your Applications folder. Ensure your macOS version meets Docker's minimum requirements before proceeding.

1. Download Docker Desktop

Navigate to the official Docker Desktop download page (docker.com/products/docker-desktop) and download the appropriate .dmg file for your Mac's chip (Intel or Apple Silicon).

2. Install the Application

Open the downloaded .dmg file. Drag the Docker icon to your Applications folder. This will copy the application to your system.

3. Launch Docker Desktop

Open your Applications folder and double-click on the Docker icon. You might be prompted to grant necessary permissions. Accept the terms and conditions.

4. Complete Initial Setup

Docker Desktop will start and perform an initial setup. You may need to sign in with your Docker ID (optional but recommended for Docker Hub access) and configure basic settings. Once the whale icon in your menu bar is stable, Docker is running.

5. Verify Installation

Open your Terminal and run docker --version and docker run hello-world to confirm Docker is correctly installed and functioning.

Uninstalling Docker Desktop from macOS

While installing Docker is simple, a complete uninstallation requires more than just dragging the application to the Trash. Docker Desktop creates various files, volumes, and configurations that should be removed for a clean slate. There are two primary methods: using the built-in uninstaller or a manual removal process.

flowchart TD
    A[Start Uninstall] --> B{Built-in Uninstaller?}
    B -- Yes --> C[Open Docker Desktop]
    C --> D["Troubleshoot" Menu]
    D --> E["Uninstall" Option]
    E --> F[Confirm Uninstall]
    F --> G[Clean Removal]
    B -- No / Manual --> H[Quit Docker Desktop]
    H --> I[Delete Application]
    I --> J[Remove Configuration Files]
    J --> K[Remove Data Volumes]
    K --> L[Remove System Files]
    L --> G

Docker Desktop uninstallation workflow on macOS

Docker Desktop includes a convenient uninstaller that handles most of the cleanup for you. This is the preferred method for a thorough removal.

1. Quit Docker Desktop

Click the Docker whale icon in your menu bar and select 'Quit Docker Desktop'.

2. Access Uninstall Option

Open Docker Desktop again from your Applications folder. Once it's running, click the Docker whale icon in the menu bar, then navigate to 'Troubleshoot' (the bug icon) and select 'Uninstall'.

3. Confirm Uninstallation

A confirmation dialog will appear. Click 'Uninstall' to proceed. You may be prompted for your administrator password.

4. Verify Removal

After the process completes, Docker Desktop should no longer be in your Applications folder, and running docker --version in Terminal should result in a 'command not found' error.

Method 2: Manual Uninstallation (Advanced)

If the built-in uninstaller fails or you prefer a more hands-on approach, you can manually remove Docker Desktop and its associated files. This method requires careful execution to ensure all components are removed.

1. Quit Docker Desktop

Ensure Docker Desktop is completely quit. Click the Docker whale icon in your menu bar and select 'Quit Docker Desktop'.

2. Delete the Application

Drag the 'Docker' application from your Applications folder to the Trash. Empty the Trash.

3. Remove Configuration and Data Files

Open Terminal and execute the following commands to remove various Docker-related files and directories. Be cautious when using rm -rf as it permanently deletes files without confirmation.

rm -rf ~/.docker
rm -rf ~/Library/Application\ Support/Docker\ Desktop
rm -rf ~/Library/Preferences/com.docker.docker.plist
rm -rf ~/Library/Saved\ Application\ State/com.docker.docker.savedState
rm -rf ~/Library/Containers/com.docker.docker
rm -rf /usr/local/bin/docker
rm -rf /usr/local/bin/docker-compose
rm -rf /usr/local/bin/docker-credential-desktop
rm -rf /usr/local/bin/kubectl
rm -rf /Applications/Docker.app

Commands to manually remove Docker Desktop files and configurations

1. Remove Docker Volumes (Optional)

If you have created Docker volumes, they might persist. You can list and remove them using Docker commands if Docker CLI is still accessible, or manually delete the ~/Library/Containers/com.docker.docker/Data/vms/0/data directory.

2. Restart Your Mac

A restart is recommended after manual uninstallation to ensure all background processes and cached files are cleared.

By following these steps, you can confidently install and completely remove Docker Desktop from your macOS system, maintaining a clean and efficient development environment.