- How to completely uninstall docker
- 10 Answers 10
- IMPORTANT UPDATES
- An update on uninstalling docker
- Remove the latest version:
- Remove previous versions:
- Completely uninstall Docker from Linux #
- Remove Docker Resources #
- Uninstall Docker #
- Uninstall Docker Compose #
- Remove Docker Group #
- Clean Unnecessary Dependencies #
- Uninstall Docker Desktop
How to completely uninstall docker
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?
10 Answers 10
To completely uninstall Docker:
To identify what installed package you have:
sudo apt-get purge -y docker-engine docker docker.io docker-ce docker-ce-cli docker-compose-plugin sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce docker-compose-plugin
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:
or, to avoid it creating back-up data for a snap you no longer require:
sudo snap remove --purge docker
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,
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
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.
the snap command is well enough but take care before you delete everything on your system with docker in the name!
The second part could delete files that belong to different packages, e.g. /usr/share/vim/vim80/syntax/dockerfile.vim
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
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
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.
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:
sudo apt-get purge docker-ce docker-ce-cli containerd.io
Delete all images, containers, and volumes:
sudo rm -rf /var/lib/docker sudo rm -rf /var/lib/containerd
Remove previous versions:
sudo apt-get remove docker docker-engine docker.io containerd runc
dpkg -l | grep -i docker sudo apt remove --purge docker-ce docker-ce-cli containerd.io sudo rm -rf /var/lib/docker sudo rm -rf /var/lib/containerd sudo apt autoremove -y sudo apt autoclean
Refreshing installation of Docker desktop and docker-ce after testing installation of Docker Desktop
After uninstalling docker desktop from ubuntu 22.04 and docker-ce (removing everything)
Then reinstalling docker engine (ce) alone as I want to run docker instance on host and separately on qemu/virt and being able to run hello-world I was getting this error
$ docker ps Cannot connect to the Docker daemon at unix:///home/christian/.docker/desktop/docker.sock. Is the docker daemon running?
Despite the user having docker group membership and permissions.
What was happening that despite uninstalling docker-desktop completely and docker-ce and then reinstalling from scratch I kept getting this error. There was no .docker/desktop/ folder
I found a config.json file .docker/config.json
that had a line «credsStore»: «desktop», «currentContext»: «desktop-linux»
So I copied it to a .bak extension and from then docker commands work properly without sudo
So it looks like uninstalling Docker Desktop is leaving at least that leftover behind.
Completely uninstall Docker from Linux #
This command is being used to list all installed packages and their respective versions. It will help you to quickly view the status of installed packages and can be useful for troubleshooting or determining dependencies between packages.
This command displays a list of installed packages containing the word «docker» (case-insensitive) in their names or descriptions. This command can help you quickly identify the specific version of installed Docker packages and verify their status.
Remove Docker Resources #
sudo docker volume prune -f sudo docker network prune -f sudo docker container prune -f sudo docker image prune -a
The commands volume prune , network prune , container prune and image prune are used to free up disk space in Docker-based systems by removing unused volumes, networks, containers, and images respectively. These commands remove unnecessary resources from the system which optimizes system performance and improves overall efficiency. The -f option is used to force the removal of these resources without prompting for confirmation.
Uninstall Docker #
sudo apt purge docker.io # or sudo apt remove docker.io
This command removes the docker package. The command remove removes the package binaries but its configuration files and installed dependencies will remain in the system. The command purge removes the package as well as its configuration files. But the dependencies will remain in the system. So, it is recommended to use purge command to uninstall docker completely.
Uninstall Docker Compose #
sudo apt purge docker-compose # or sudo apt remove docker-compose
This command will remove docker-compose package from your Linux system. The command remove removes the package binaries but its configuration files and installed dependencies will remain in the system. The command purge removes the package as well as its configuration files. But the dependencies will remain in the system. So, it is recommended to use purge command to uninstall docker completely.
Remove Docker Group #
This command will delete docker group from your Linux system.
Clean Unnecessary Dependencies #
This command removes packages installed as dependencies for other packages but no longer needed. This helps to free up disk space and keep the system clean.
This command removes obsolete package files, freeing up disk space and optimizing system performance.
Finally, you should restart your system and chill for while.
Uninstall Docker Desktop
To uninstall Docker Desktop from your Windows machine:
- From the Windows Start menu, select Settings >Apps >Apps & features.
- Select Docker Desktop from the Apps & features list and then select Uninstall.
- Click Uninstall to confirm your selection.
Important
Uninstalling Docker Desktop destroys Docker containers, images, volumes, and other Docker related data local to the machine, and removes the files generated by the application. Refer to the back up and restore data section to learn how to preserve important data before uninstalling.
To uninstall Docker Desktop from your Mac:
- From the Docker menu, select the Troubleshoot icon in the top-right corner of Docker Dashboard and then select Uninstall.
- Click Uninstall to confirm your selection.
Uninstall Docker Desktop from the command line
To uninstall Docker Desktop from a terminal, run: /Contents/MacOS/uninstall . If your instance is installed in the default location, this command provides a clean uninstall:
$ /Applications/Docker.app/Contents/MacOS/uninstall Uninstalling Docker Desktop. Docker uninstalled successfully. You can move the Docker application to the trash.
You might want to use the command-line uninstall if, for example, you find that the app is non-functional, and you cannot uninstall it from the menu.
Note
Uninstalling Docker Desktop destroys Docker containers, images, volumes, and other Docker related data local to the machine, and removes the files generated by the application. Refer to the back up and restore data section to learn how to preserve important data before uninstalling.
Docker Desktop can be removed from a Linux host using the package manager.
Once Docker Desktop has been removed, users must remove the credsStore and currentContext properties from the ~/.docker/config.json .
Note
Uninstalling Docker Desktop destroys Docker containers, images, volumes, and other Docker related data local to the machine, and removes the files generated by the application. Refer to the back up and restore data section to learn how to preserve important data before uninstalling.
To remove Docker Desktop for Ubuntu, run:
$ sudo apt remove docker-desktop
For a complete cleanup, remove configuration and data files at $HOME/.docker/desktop , the symlink at /usr/local/bin/com.docker.cli , and purge the remaining systemd service files.
$ rm -r $HOME/.docker/desktop $ sudo rm /usr/local/bin/com.docker.cli $ sudo apt purge docker-desktop
Remove the credsStore and currentContext properties from $HOME/.docker/config.json . Additionally, you must delete any edited configuration files manually.
To remove Docker Desktop for Debian, run:
$ sudo apt remove docker-desktop
For a complete cleanup, remove configuration and data files at $HOME/.docker/desktop , the symlink at /usr/local/bin/com.docker.cli , and purge the remaining systemd service files.
$ rm -r $HOME/.docker/desktop $ sudo rm /usr/local/bin/com.docker.cli $ sudo apt purge docker-desktop
Remove the credsStore and currentContext properties from $HOME/.docker/config.json . Additionally, you must delete any edited configuration files manually. preserve important data before uninstalling.
To remove Docker Desktop for Fedora, run:
$ sudo dnf remove docker-desktop
For a complete cleanup, remove configuration and data files at $HOME/.docker/desktop , the symlink at /usr/local/bin/com.docker.cli , and purge the remaining systemd service files.
$ rm -r $HOME/.docker/desktop $ sudo rm /usr/local/bin/com.docker.cli
Remove the credsStore and currentContext properties from $HOME/.docker/config.json . Additionally, you must delete any edited configuration files manually.
To remove Docker Desktop for Arch, run:
$ sudo pacman -R docker-desktop
For a complete cleanup, remove configuration and data files at $HOME/.docker/desktop , the symlink at /usr/local/bin/com.docker.cli , and purge the remaining systemd service files.
$ rm -r $HOME/.docker/desktop $ sudo rm /usr/local/bin/com.docker.cli $ sudo pacman -Rns docker-desktop
Remove the credsStore and currentContext properties from $HOME/.docker/config.json . Additionally, you must delete any edited configuration files manually.