I followed the uninstall instructions here. Then I ran these commands:
sudo apt-get purge docker-engine
sudo apt-get autoremove --purge docker-engine
rm -rf /var/lib/docker
So after I did all this I ran this command to see if docker files are any where else:
sudo find / -name '*docker*'
I found several places where docker files still exists.
/etc
/sys
/lib
/usr
/usr
/run
/proc
/var
Docker exists in subfolders in the list above. I can post every path if you like. There is about 200 locations.
Is there a way to totally and completely remove docker everywhere?
To completely uninstall Docker:
Step 1
To identify what installed package you have:
Step 2
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:
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:or, to avoid it creating back-up data for a snap you no longer require:
To find any potentially remaining files, you can run
If you want to delete everything listed (be careful because this is typically not what you actually want), you can run,
IMPORTANT UPDATES
As mentioned in the comments,
and
So better to see what is going to be deleted first.
Collaborated list collected from above posts and comments fro removing docker and docker-compose:
Add docker-ce-cli package also while doing purge of docker
Steps performed in order to remove docker on Centos 7:
Hope this information could be helpful for someone.
Best regards,
An update on uninstalling docker
Just an update on this, after I had to deal with the same issue.
Here is the official docker documentation on removing docker.
Remove the latest version:
Uninstall the Docker Engine, CLI, and Containerd packages:
Delete all images, containers, and volumes:
Remove previous versions:
Remove docker completly
You can identify the packages those files originated from with a command like
dpkg-query -S $(sudo find / -name '*docker*' -print 2>/dev/null)
. Any such packages that you do not need, you can remove withsudo apt-get purge <package>
. Please use care when you do so as some packages include some support for docker, but you might not want to remove, say, a text editor or a file manager for that reason.If some files did not originate from packages (indicated by "dpkg-query: no path found matching pattern path"), you can remove them individually. Again, please use caution, as there may be files unrelated to the docker you want to remove, which simply have the string "docker" in their names.