Docker is a lightweight and easy-to-manage containerization technology for applications and services. However, if you no longer need Docker, or need to clear the Docker environment to reinstall or upgrade the version, then you will need to completely remove Docker. This article will show you how to remove Docker completely.
Before uninstalling Docker, you need to stop and delete all Docker containers from the host machine. Executing the following command will stop and delete all running Docker containers:
docker stop $(docker ps -a -q) docker rm $(docker ps -a -q)
Docker images are the basis for building Docker containers. You need to delete them before uninstalling Docker. Executing the following command will delete all Docker images:
docker rmi $(docker images -q)
First, stop the Docker daemon. Execute the following command:
sudo service docker stop
Next, uninstall the Docker daemon. If you use the apt-get package manager to install Docker, execute the following command:
sudo apt-get purge docker-ce
If you use the yum package manager to install Docker, execute the following command:
sudo yum remove docker-ce
If you If you use the pkg package manager to install Docker, execute the following command:
sudo pkg remove docker-ce
After uninstalling Docker, you need to delete all Docker configuration and data . Executing the following command will delete all Docker configuration and data:
sudo rm -rf /var/lib/docker
If you created groups and users using Docker, you will also need to delete them . Executing the following command will delete the Docker group and user:
sudo groupdel docker sudo userdel docker
If you did not create the Docker group and user before uninstalling Docker, you can skip this step.
Summary
In this article, we showed you how to remove Docker completely. We mentioned that all Docker containers and images must be stopped and removed, the Docker daemon must be uninstalled, all Docker configuration and data deleted, and Docker groups and users deleted. After performing the above steps, you can install or upgrade your Docker version and start using Docker containerization technology again.
The above is the detailed content of Detailed explanation of how to completely delete docker. For more information, please follow other related articles on the PHP Chinese website!