The way you install and uninstall Docker depends on your operating system. Different Linux distributions, like Debian-based, Red Hat, and Arch Linux, also have different approaches for uninstalling Docker.

Uninstall Docker From Linux

Linux is the most popular command-line OS utilized by administrators, cyber professionals, software engineers, and students. Most users prefer to use Docker on Linux systems due to better management of system memory and performance. Docker is open-source and available for different Linux distros. So, the installation and uninstallation process of Docker varies from distro to distro. To uninstall Docker from Debian-based, Red hat based and Arch Linux distros, follow the below guidelines:

Uninstall Docker From Debian-based Linux Distro

Debian-based operating systems include Ubuntu, Kali Linux, MX Linux, Pop!_OS, and many more. To remove Docker, we will use Ubuntu 22.04. However, the procedure will remain the same to remove Docker from Debian-based distributions.

Follow the below illustration to remove Docker:

Step 1: Uninstall Docker Packages

To remove Docker from the Ubuntu distribution, remove the following packages:

  • docker-ce” is the Docker engine community edition
  • docker-ce-cli” is a Docker engine command line community edition
  • containerd.io” is a container runtime used with the Docker engine
  • docker-buildx-plugin” package to extend the build capabilities
  • docker-compose-plugin” plugin to run docker-compose service.

To remove the above-stated packages from Ubuntu, execute the “sudo apt purge <package-name>” command as mentioned below:

sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras

Step 2: Remove Docker Directories

Remove the Docker directories where data is stored. Usually, Docker volumes are stored in the “/var/lib/docker” directory. To remove the volumes, run the below command:

sudo rm -rf /var/lib/docker /etc/docker
sudo rm -rf /var/lib/docker /etc/docker

Next, remove the docker-compose installation folder:

sudo rm -rf /usr/local/bin/docker-compose
sudo rm -rf /usr/local/bin/docker-compose

In the next step, remove the “docker” directory to completely uninstall Docker:

sudo rm -rf /etc/docker
sudo rm -rf /var/lib/containerd

To clear the cache of Docker in Ubuntu, remove the “~/.docker” hidden folder: 

sudo rm -rf ~/.docker
sudo rm -rf ~/.docker

Now, remove the containerd directory to remove containers and container runtime tool completely:

sudo rm -rf /var/lib/containerd
sudo rm -rf /var/lib/containerd

Step 3: Clean Ubuntu 

After that, clean the system from unused dependencies and orphan files using the “apt autoremove” command:

sudo apt autoremove
sudo apt autoremove

Uninstall Docker From RHEL-based Distro (Fedora)

Fedora is an open-source Red Hat-based Linux distribution. It differs from Debian and uses “dnf” instead of the APT repository. To remove Docker from Fedora, go through the below demonstration:

Step 1: Remove Docker

To remove the Docker from Fedora Linux, simply use the “sudo dnf remove <package-name>” command. The “dnf” is the package manager of Fedora Linux as APT in Debian-based Linux distributions:

sudo dnf remove docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras

Step 2: Remove Docker Directories

Now, remove the directories where Docker data is stored. The below command will remove the “docker” directory recursively:

sudo rm -rf /var/lib/docker

Next, remove the “containerd” directory where the container runtime tool stores the containers running in Docker:

sudo rm -rf /var/lib/containerd

Uninstall Docker From Arch Linux

Arch is an independent Linux distribution that lets you have more control over your system. Many users try to use Docker on Arch. But Docker does not provide any stable release to support Arch or any package to run the Docker engine but some packages to test Docker on Arch Linux. To remove Docker from Arch Linux, look at the below steps.

Step 1: Remove Docker

On Arch Linux, the “pacman” package manager is used to install and remove packages from the system. To remove Docker from Arch, simply run the “sudo pacman -R docker” command:

sudo pacman -R docker

Step 2: Remove Docker Directory

Next, remove the Docker directory where the containers and  Docker configurations are stored. To do so, simply run the “rm -r <Path-to-Docker>” command:

rm -r $HOME/.docker

That is how Docker is completely removed from different Linux distributions. To uninstall Docker from Windows and Mac OS, follow the below sections.

Uninstall Docker From Windows

On Windows, Docker is installed through the “Docker Desktop” application. This application includes all the essential packages to run Docker such as Docker CLI, Docker compose, Docker buildx, and much more. To completely uninstall Docker from Windows, the user needs to remove the Docker Desktop application. For this purpose, check out the following process:

Step 1: Launch Apps & Feature Settings

First, launch the Windows system settings using the “Window+I” shortcut key. After that, navigate to the “Apps” setting from the left pane and open the “Apps & features” settings from the right pane:

Apps> Apps & Feature Settings

Step 2: Search Docker

Next, search for “Docker” in the “App list” search bar. Then, choose the Docker Desktop application and click on the below pointed “vertical three dots” icon:

 Apps & Feature Settings >Docker Desktop

Step 3: Uninstall Docker Desktop

Now, click on the “Uninstall” option to remove the Docker Desktop application:

Uninstall Docker

Upon doing so, the Docker Desktop window will appear on the screen that will automatically run the uninstallation script.  After that, simply close the Window and Docker will be uninstalled from the system:

Docker Desktop Close Window

Uninstall Docker From Mac

Similar to Windows, Docker on Mac is installed through the Docker Desktop application. To uninstall or remove the Docker from Mac Os, remove the Docker Desktop application by following the below process:

Step 1: Launch Finder

First, launch the Finder tool by hitting the below icon:

Finder

Step 2: Launch Docker Desktop Application

Navigate to the “Applications” directory, and double-click on the Docker Desktop app to launch it:

Applications Folder

Step 3: Navigate to Troubleshooting Option

Next, click on the below pointed “bug” icon to open the Docker Troubleshoot settings:

Docker Troubleshoot Settings

Step 4: Uninstall Docker

Now, press the “Uninstall” button to uninstall the Docker Desktop from Mac:

Uninstall Docker

The confirmation box will appear on the screen. To continue to remove Docker from Mac, press the “Uninstall” button:

Uninstall Docker Desktop

This will remove Docker completely from Mac OS.

Uninstall Docker From Mac Terminal

Alternatively, the user can remove the Docker Desktop application from the terminal using the below command:

sudo rm -rf /Applications/Docker.app
sudo rm -rf /Applications/Docker.app

This is all about uninstalling Docker completely from Mac, Windows, and Linux distros.

Conclusion

To remove the Docker from Linux, remove the “docker-ce”, “docker-ce-cli”, “containerd.io”, “docker-buildx-plugin”, and “docker-compose-plugin” packages using the “sudo apt remove <package-name>” command. To uninstall Docker from Windows or MacOS, simply uninstall the “Docker Desktop” application. This blog has illustrated the methods to uninstall Docker from Windows, Linux distros, and Mac OS.