February 21, 2025

How to Correctly Uninstall Docker Desktop on Linux Ubuntu

In this tutorial, we explain how to completely erase Docker Desktop on Linux Ubuntu. Note that although they serve almost the same purpose, Docker Desktop is different from Docker Engine. Docker Engine is only a set of command line tools for managing docker images and containers. On the other hand, Docker Desktop is the full Graphics User Interface for Docker, and it contains a number of tools for managing Docker containers and images.

WARNING: Uninstalling Docker Desktop removes all Docker containers, images, volumes, and other Docker configuration files. If you need to preserve containers and images, or some other configuration files, make sure that you backup the files you need.

The YouTube tutorial is given below.

First of all, erase all containers, images, volumes, etc. To see all running and stopped Docker containers

docker ps -a

To see all images

docker images -a

First, we need to erase all containers. Then, we need to erase all images. To erase all containers

docker rm -vf $(docker ps -aq)

To erase all images

docker rmi -f $(docker images -aq)

Finally, to make sure that everything is deleted, that is to remove all unused containers, volumes, networks and images, type this:

docker system prune -a --volumes

Next, we need to stop Docker Desktop

systemctl --user stop docker-desktop

To identify all packages associated with Docker

dpkg -l | grep -i docker

Note over here that you might have also Docker Engine packages. We do not have them, however, you might have them. We do not take responsibility if you also erase the Docker Engine. You can actually easily reinstall it (see the video tutorials on this channel). We are going to erase everything including possible docker engine packages.

Then, type:

sudo apt remove docker-desktop

Then erase the hidden folder ~/.docker (in the home folder and other stuff)

sudo rm -rf ~/.docker
sudo rm /usr/local/bin/com.docker.cli
sudo apt purge docker-desktop

If these files and folders exist erase them:

sudo rm /etc/apt/sources.list.d/docker.list
sudo rm /etc/apt/keyrings/docker.asc
sudo rm -rf /etc/docker

Then, remove additional packages that are listed by “dpkg -l | grep -i docker“:

sudo apt-get purge docker-ce-cli
sudo apt-get purge docker-buildx-plugin
sudo apt-get purge docker-compose-plugin

Install plocate and search anything related to Docker:

sudo apt install plocate
sudo updatedb

Then, we need to search for docker

plocate docker

and search for files and folders containing docker in their name. You should not erase all the files (only the files mentioned in the video tutorial).