How to completely uninstall docker

PHPz
Release: 2023-04-18 15:45:12
Original
40361 people have browsed it

With the rapid development of cloud computing and container technology, Docker has become one of the most popular containerized application platforms today. However, for some users, they may encounter some problems, such as being unable to start Docker containers, unable to update Docker, etc. These issues may be related to Docker not being removed properly. This article will show you how to completely uninstall Docker to resolve these issues.

Step 1: Stop Docker

Before uninstalling Docker, you first need to stop Docker.

On the terminal, enter the following command to stop the running Docker service:

$ sudo systemctl stop docker
Copy after login

Step 2: Remove the Docker package

Docker contains many software packages. Therefore, you need to delete them all.

On the terminal, enter the following command to delete the Docker package:

$ sudo apt-get purge docker-ce
Copy after login

This command will delete the Docker package and dependencies.

Step 3: Delete the Docker directory and files

After deleting the Docker package in the previous step, you need to manually delete the Docker directory and files.

On the terminal, enter the following command to delete the Docker directory and files:

$ sudo rm -rf /var/lib/docker
$ sudo rm -rf /etc/docker
$ sudo rm /etc/apparmor.d/docker
$ sudo groupdel docker
Copy after login

The first command will delete the /var/lib/docker directory, which is the container image generated during Docker running. The location of files such as containers.

The second command will delete the /etc/docker directory, which is the location of Docker's configuration file.

The third command will delete the AppArmor policy.

The last command will delete the Docker user group.

Step Four: Delete Docker Repository

This is the final step so that Docker will be completely removed from your system.

On the terminal, enter the following command to delete the Docker repository:

$ sudo apt-get remove docker-ce-cli
$ sudo apt-get autoremove -y
Copy after login

The first command will delete the Docker CE CLI from the repository.

The second command will automatically remove dependencies.

Now you have successfully removed Docker from your system.

You can use the following command to verify whether the uninstallation was successful.

$ docker --version
Copy after login

If the output is similar to "docker command not found", it means it has been successfully deleted.

Conclusion:

The above are the steps to completely uninstall Docker. When a problem occurs, it is recommended to perform these steps first, completely delete Docker and reinstall it to ensure the correctness and stability of Docker.

The above is the detailed content of How to completely uninstall docker. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template