I have installed Docker using Docker's official apt repo.
My question is, if I uninstall it using sudo apt-get remove docker docker-engine docker.io containerd runc
. Will Docker containers and images will also be deleted?
Or should I run a docker system prune
explicitly before uninstall?
All the data is in
/var/lib/docker
. However, this data will not be removed when uninstalling the packages.So it can be removed with:
To piggy back on @ArturMeinild answer, I'd like to add a general explanation from Apt's perspective, which can help explain what data would not be deleted, as it's always safe to assume that the answer would be no.
In general,
apt remove
removes all files installed by the deb package except configuration files (which are usually under/etc
) and user-generated files*.The other option is to use
apt prune
, but in general, it just deletes whatapt remove
deletes, plus the configuration under/etc
. But it also ignores user-generated files.* User-generated files don't necessarily mean the user needs to create them manually, but they can also be files that are generated by the binary (such as containers and images in this case)