Uninstall Docker from Ubuntu
Updated August 29, 2026
Uninstalling Docker has two separate parts: removing packages and deciding what to do with local data. First list the installed Docker packages and stop workloads you still need.
dpkg -l | grep -E 'docker|containerd'
sudo systemctl stop docker
Remove the packages using the package manager that installed them. For a Docker repository installation on Ubuntu, Docker documents a package set like this; inspect dpkg -l first if your installation differs:
sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
Package removal does not necessarily delete images, containers, and volumes. Docker's data directories commonly include /var/lib/docker and /var/lib/containerd, but deleting them is destructive. Export or back up volumes first, then remove those directories only if a complete data wipe is intended.
Do not mix an old cleanup script with a newer installation. Afterward check command -v docker, service units, and any repository entries. If you plan to reinstall, keep data only when you understand which engine and storage format will reuse it.
Sources
related.
Ruslan Osipov
About the author