# How To Completely Uninstall Docker On Ubuntu

> Check out our beginner friendly guide on how to remove docker step-by-step with easy copy and paste commands.

- Author: [CJ Saathoff](https://www.namehero.com/blog/author/cj-saathoff/)
- Published: 2025-01-21
- Updated: 2025-01-21
- Category: [Linux Command Line](https://www.namehero.com/blog/category/linux-command-line/)
- Web page: https://www.namehero.com/blog/how-to-completely-uninstall-docker-on-ubuntu/

[![](https://blogcdn.namehero.com/blog/wp-content/uploads/2025/01/14160110/howtocompletelynuinstall-1024x576.jpg)](https://blogcdn.namehero.com/blog/wp-content/uploads/2025/01/14160110/howtocompletelynuinstall.jpg)

Docker allows you to containerize your applications, making it rather easy to distribute the entire software stack needed for applications to run. Have you decided you no longer have a need for docker on your Ubuntu system and would like to remove it completely? If so this post is for you, as we will go through how to completely uninstall docker step by step.

## Before You Start

- Make sure that you want to remove Docker and that you or another user aren’t using any services inside of Docker.
- Ensure you have the necessary permissions to uninstall Docker, you will need either root access or sudo permissions.
- Back up any data or configurations even if there is a slight chance you may need the data in the future.

## Stop All Containers and Data

First, run docker commands to stop any currently active Docker containers.

```

sudo docker stop $(sudo docker ps -q)

```

In case you have containers set to restart we will force remove them as the cleanup command below won’t.

```

sudo docker rm -f $(docker ps -aq)

```

Next let’s use docker’s built-in cleanup command to remove all stopped docker containers, unused networks, docker images, and docker files.

```

sudo docker system prune --volumes

```

Run the following command to check if there are any containers left on your system. You should see an empty output if all containers have been successfully removed.

```

sudo docker ps -a

```

## Uninstallation

Run the following commands to uninstall docker packages like docker itself, compose, and even docker desktop from your system.

```

sudo apt-get remove 'docker*'

```

To ensure that any configuration files associated with Docker packages are also removed, use the purge command:

```

sudo apt-get purge 'docker*'

```

## Clean Up

After removing the Docker packages, you should delete the data directory where images, containers, and volumes are stored. This ensures that no residual Docker data remains.

```

sudo rm -rf /var/lib/docker

```

Since Docker relies on containerd for runtime management, it’s also a good idea to clear out its data directory.

```

sudo rm -rf /var/lib/containerd

```

**Note: **If you used a different location for storing data or edited configuration files those likely haven’t been removed. You will need to address those individually.

## Removing Docker GPG Key and Repository

Finally, remove any APT source lists and GPG keys associated with Docker that were added for installation from the official repository. This ensures you have no leftover configuration that might cause issues in the future.

```

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

```

## Verifying the Uninstallation

To make sure there are no more related docker processes running, run the following command:

```

ps a | grep docker

```

You can check if any Docker-related packages are still installed by running:

```

dpkg -l | grep -E 'docker'

```

**Note:** If you see a docker-related package still running or installed, try rebooting and see if that solves it.

## Conclusion

In this post, we covered the steps to completely remove Docker from your Ubuntu-based system. From prerequisites to stopping all containers and removing their data, to uninstalling docker, cleanup, removing GPG keys, and verification. You have now finished as well as other docker packages like uninstalling docker desktop uninstalling Docker. If you decide you later want to reinstall Docker, you can run the same commands as you used when you installed it before. Consider reinstalling Docker Engine using the official installation instructions.

## Looking For More

Done reading and looking for more, why not check these out?

- [Docker VS LXC](https://www.namehero.com/blog/lxc-vs-docker-choosing-a-container-platform/)
- [Official Docker Docs](https://docs.docker.com/)
- [My Other Posts](https://www.namehero.com/blog/author/cjthedj97/)

## Related posts

- [How To Uninstall A Package In Ubuntu](https://www.namehero.com/blog/how-to-uninstall-a-package-in-ubuntu/)
- [Curl Headers, Cookies, and Authentication](https://www.namehero.com/blog/curl-headers-cookies-and-authentication/)
- [Linux Process Management: ps, htop, kill, and nice](https://www.namehero.com/blog/linux-process-management-ps-htop-kill-and-nice/)
