Docker is one of the most widely used containerization platforms. But there may come a time when you need to remove Docker from your system, maybe to free up space, switch to another version, or perform a clean reinstallation.
Before removing Docker, it’s recommended to stop all running containers:
docker container stop $(docker container ls -aq)
This ensures no container processes interfere with the uninstall.
To free up space, remove unused containers, images, networks, and volumes:
docker system prune -a --volumes
-a
removes all unused images.--volumes
removes all volumes.⚠️ Warning: This deletes all Docker data permanently.
Remove the Docker packages installed on your system:
sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras -y
Clean up unnecessary dependencies:
sudo apt autoremove -y
Docker stores images, containers, and other runtime files in /var/lib/docker
and /var/lib/containerd
. To completely wipe Docker from your system:
sudo rm -rf /var/lib/{docker,containerd}
Check if Docker has been removed:
docker --version
If Docker was removed successfully, this command will return:
Command 'docker' not found
Whether you’re troubleshooting issues, switching versions, or simply no longer need Docker, these steps ensure a clean removal from your system.
Read More : Install Docker On Ubuntu
Introduction to the Model Context Protocol (MCP) The Model Context Protocol (MCP) is an open…
While file extensions in Linux are optional and often misleading, the file command helps decode what a…
The touch command is one of the quickest ways to create new empty files or update timestamps…
Handling large numbers of files is routine for Linux users, and that’s where the find command shines.…
Managing files and directories is foundational for Linux workflows, and the mv (“move”) command makes it easy…
Creating directories is one of the earliest skills you'll use on a Linux system. The mkdir (make…