How to Uninstall Docker Completely from Debian
If you no longer need Docker on your Debian system, here’s how to fully remove Docker and its related components, including docker-compose
. Follow these steps for a thorough cleanup:
1. Stop Docker Services
sudo systemctl stop docker
sudo systemctl stop docker.socket
2. Remove Docker Packages
Uninstall Docker Engine and all related components:
sudo apt-get purge -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
If you previously installed older versions:
sudo apt-get purge -y docker docker-engine docker.io containerd runc
3. Remove Manually Installed Docker Compose (if any)
If you installed docker-compose
manually (e.g. via curl
or pip
), remove it like this:
sudo rm -f /usr/local/bin/docker-compose
sudo pip uninstall docker-compose
4. Delete Docker Data (Optional but Recommended)
This will remove all Docker images, containers, volumes, and custom configurations:
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
sudo rm -rf ~/.docker
5. Remove Unused Dependencies
sudo apt-get autoremove -y
6. Verify Docker and Docker Compose Are Gone
which docker
which docker-compose
docker --version
docker-compose --version
All commands should return “command not found” or no path if Docker and Docker Compose are fully removed.
Done! You’ve successfully removed all Docker-related components from your system.
Let us know in the comments if you’d like help reinstalling or migrating to alternatives like Podman.
This post is also available in fr_FR.