How to completely uninstall docker
To completely uninstall Docker:
Step 1
dpkg -l | grep -i docker
To identify what installed package you have:
Step 2
sudo apt-get purge -y docker-engine docker docker.io docker-ce docker-ce-cli
sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce
The above commands will not remove images, containers, volumes, or user created configuration files on your host. If you wish to delete all images, containers, and volumes run the following commands:
sudo rm -rf /var/lib/docker /etc/docker
sudo rm /etc/apparmor.d/docker
sudo groupdel docker
sudo rm -rf /var/run/docker.sock
You have removed Docker from the system completely.
If you are on Ubuntu, I find it much easier to uninstall docker if it is installed with snap
. You simply do:
sudo snap remove docker
or, to avoid it creating back-up data for a snap you no longer require:
sudo snap remove --purge docker
and to delete all related files,
sudo find / -name "*docker*" -exec `rm -rf` {} +
IMPORTANT UPDATES
As mentioned in the comments,
The second part is not needed and just dangerous, at least run it without
-exec `rm -rf` {} +
first
and
The second part could delete files that belong to different packages, e.g.
/usr/share/vim/vim80/syntax/dockerfile.vim
So better to see what is going to be deleted first.
Add docker-ce-cli package also while doing purge of docker
sudo apt-get purge -y docker-engine docker docker.io docker-ce docker-ce-cli
Collaborated list collected from above posts and comments fro removing docker and docker-compose:
sudo apt-get purge -y docker-engine docker docker.io docker-ce
sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce
sudo umount /var/lib/docker/
sudo rm -rf /var/lib/docker /etc/docker
sudo rm /etc/apparmor.d/docker
sudo groupdel docker
sudo rm -rf /var/run/docker.sock
sudo rm -rf /usr/bin/docker-compose
Steps performed in order to remove docker on Centos 7:
yum list installed|grep -i docker
yum remove containerd.io.x86_64 docker-ce.x86_64 docker-ce-cli.x86_64
groupdel docker
ls /var/lib/docker/
rm -rf /var/lib/docker /etc/docker
rm -rf /var/run/docker.sock
rm -rf /var/run/docker
find /var -iname "*docker*"
Hope this information could be helpful for someone.
Best regards,