Uninstalling Docker in CentOS can be divided into the following steps:
1. Stop all running containers
Stop all running containers with the command:
sudo docker stop $(docker ps -aq)
This command stops all containers, both running and stopped.
2. Delete all containers
Remove all containers with the following command:
sudo docker rm $(docker ps -aq)
This command will delete all containers, both running and stopped.
3. Delete all mirrors
Remove all mirrors with the following command:
sudo docker rmi $(docker images -q)
This command deletes all images, including those not used by containers.
4. Uninstall the Docker engine
Uninstall the Docker engine with the following command:
sudo yum remove docker-ce docker-ce-cli containerd.io
This command will remove the Docker engine and its dependent packages and files.
5. Delete the Docker data directory
Delete the Docker data directory with the following command:
sudo rm -rf /var/lib/docker
This command will delete the Docker data directory, including all containers, images, and data volumes.
After completing the above steps, Docker has been completely uninstalled.