Edited 1 week ago by ExtremeHow Editorial Team
Docker DesktopLinuxUninstallationRemovalDevOpsSystem MaintenanceCloud ComputingVirtual MachinesSecurityCleanup
This content is available in 7 different language
Docker is a platform used to develop, ship, and run applications using container technology. It simplifies the application development process by creating a comprehensive set of tools to build applications in a controlled environment. Docker Desktop is a user-friendly application designed specifically for Windows and Mac, providing developers the ability to use Docker and Kubernetes in a familiar desktop environment. However, Docker Desktop is not natively available for Linux as Linux has a different way of integrating with Docker. So when we talk about uninstalling Docker Desktop from Linux, we usually refer to removing Docker components such as the Docker Engine, CLI, and other tools.
This detailed guide will explain the process of uninstalling Docker from a Linux system. The guide will cover each step required to ensure that all components and configurations associated with Docker are removed. By following the steps below, you can completely uninstall Docker, prepare your system for a new installation, or simply clean up its resources.
Before you begin, make sure you have:
The first step to uninstall Docker is to stop any running Docker services. By stopping these services, you ensure that no existing containers or processes interfere with the uninstallation process. To stop Docker services, execute the following command:
sudo systemctl stop docker
Here, systemctl
is a system command used to check and control the systemd system and service manager. We use stop
to stop the docker process. sudo
command elevates your privileges to administrator or root, allowing you to make important changes to the system.
Once the Docker service is stopped, it's time to remove the Docker package from your system. Different Linux distributions have different package managers, so the uninstallation command depends on the system you're using. Below, we'll explain the commands for some commonly used Linux systems.
Use apt
package manager:
sudo apt-get purge docker-ce docker-ce-cli containerd.io
The command apt-get purge
will permanently remove configuration files as well as packages, making sure nothing gets left behind.
Use the dnf
package manager:
sudo dnf remove docker-ce docker-ce-cli containerd.io
Fedora uses dnf
to manage software packages, which can replace Docker and its dependencies.
Use the yum
package manager:
sudo yum remove docker-ce docker-ce-cli containerd.io
CentOS and RHEL rely on yum
, similar to Fedora's dnf
, to manage packages.
Next, we must remove Docker entities such as images, containers, volumes, and networks. These are not removed automatically when you uninstall Docker, so it is necessary to remove them manually to free up disk space.
sudo rm -rf /var/lib/docker
rm
command removes files and directories. We use -rf
flag to remove directories non-interactively and recursively. The directory /var/lib/docker
is the default location where Docker stores images, containers, volumes, and networks.
After executing the removal commands, it is prudent to verify if Docker has been completely uninstalled. You can do this by checking the status of the Docker Engine:
docker --version
If Docker is successfully removed, the above command should return a message that Docker could not be found or is not installed. Alternatively, a successful uninstallation should result in:
Command 'docker' not found, but can be installed with:
Docker uses a user group called docker
that allows regular system users with appropriate permissions to execute Docker commands without using sudo
. To completely clean up your system, you should remove this group:
sudo groupdel docker
This step is optional as removing the Docker group will not affect your system's performance. It is mainly for the hygiene of the user list.
After these steps, your system should be free of any Docker-related files or configurations. This means you have successfully uninstalled Docker from your Linux system. If you want to reinstall Docker, make sure you get the latest version appropriate for your development needs by following the Docker installation guide for your specific Linux distribution.
In this guide, we have explained the steps required to completely uninstall Docker Desktop from a Linux system. The process includes stopping Docker services, removing Docker packages, deleting related system directories, and cleaning up Docker files such as images and containers. Although Docker has no native desktop version for Linux, this process references common Docker components and utility removal. It is important to understand these steps, especially if you want to perform a clean reinstall or simply reclaim system resources.
Efficiency in removing Docker lies in using the specific package manager for your Linux distribution. By following this guide, you can ensure that all traces of Docker are removed, freeing up resources on your system and avoiding potential conflicts during future installations. If you plan to continue using Docker, always make sure you maintain up-to-date knowledge on best practices for installation, configuration, and removal on your specific Linux setup.
If you find anything wrong with the article content, you can