Uninstall Docker Ubuntu
Updated July 15, 2023

Uninstalling Docker on Ubuntu is a straightforward process that can be completed in a few simple steps. Whether you're looking to free up disk space or switch to a different containerization platform, this guide will walk you through the uninstallation process. Read on to learn how to remove Docker from your Ubuntu system.
Removing Docker on Ubuntu
To uninstall Docker on Ubuntu, you can follow these steps:
Stop Docker containers and services
Before uninstalling Docker, it is important to stop any running Docker containers and services. This ensures that the uninstallation process goes smoothly without any interruptions. You can do this by running the following command:
sudo systemctl stop dockerRemove Docker packages
Next, you need to remove the Docker packages from your system. Ubuntu uses the Advanced Packaging Tool (APT) for package management. To uninstall Docker, run the following command:
sudo apt-get purge docker-ce docker-ce-cli containerd.ioThis command removes the Docker packages along with their configurations and dependencies.
Delete Docker files and directories
After removing the Docker packages, there might be leftover files and directories that need to be deleted. These files include Docker images, containers, volumes, and network settings. To delete these files, run the following commands:
sudo rm -rf /var/lib/docker sudo rm -rf /etc/dockerThe
rm -rfcommand recursively deletes the specified directories and their contents.Remove Docker data
If you want to completely remove all Docker data from your system, including images, containers, and volumes, you can use the following command:
sudo rm -rf /var/lib/dockerMake sure to use this command with caution, as it permanently deletes all Docker data and cannot be undone.
Related Articles
Here are some articles that you may find helpful in your journey with Docker and containerization:
- How to start Docker daemon
- Docker command not found on Mac - 2023 solution
- Introduction to Containerization
- Managing Microservices with Docker Swarm and Kubernetes
- Docker Vs Kubernetes: Which Container Orchestration Tool Should You Choose?
Uninstalling Docker on Ubuntu is a simple process that allows you to easily switch to a different containerization platform or free up disk space. By following the steps outlined in this article, you can ensure a clean and complete uninstallation of Docker from your system. Remember to stop Docker containers and services, remove Docker packages, delete Docker files and directories, and optionally remove Docker data.
Related video
faqs.
Can I uninstall Docker on Ubuntu?
Yes, you can uninstall Docker on Ubuntu.
How do I stop Docker containers and services?
You can stop Docker containers and services by running sudo systemctl stop docker.
Which command can I use to remove Docker packages?
To remove Docker packages, use the command sudo apt-get purge docker-ce docker-ce-cli containerd.io.
What directories and files should I delete after uninstalling Docker?
After uninstalling Docker, you can delete the /var/lib/docker and /etc/docker directories.
Is it possible to completely remove all Docker data?
Yes, you can use sudo rm -rf /var/lib/docker to remove all Docker data.
Are the steps the same for all versions of Ubuntu?
Yes, the steps to uninstall Docker on Ubuntu are the same for all versions.
Can I reinstall Docker after uninstalling it?
Yes, you can reinstall Docker after uninstalling it.
Do I need to restart my system after uninstalling Docker?
No, restarting your system is not necessary after uninstalling Docker.
Can I use these steps to uninstall Docker on other Linux distributions?
These steps are specific to Ubuntu and may not work for other Linux distributions.
Is it safe to uninstall Docker?
Yes, it is safe to uninstall Docker as long as you follow the proper uninstallation steps.
related.
Ruslan Osipov
About the author