Home  >  Article  >  Operation and Maintenance  >  Detailed explanation of how to properly shut down Docker

Detailed explanation of how to properly shut down Docker

PHPz
PHPzOriginal
2023-04-17 16:43:584441browse

Docker is an open source software project that helps developers easily package, publish and run applications. However, how do we shut down Docker when we no longer need it? This article will explain in detail how to shut down Docker correctly.

  1. Command Line Shutdown Docker

Shutting down Docker from the command line is very simple, just execute the following command:

$ sudo systemctl stop docker

This will stop immediately All running Docker containers and processes. If you want to restart Docker, please use the following command:

$ sudo systemctl start docker
  1. Close Docker using Docker Desktop

If you want to shut down Docker while using Docker Desktop, Please follow the steps below:

  • macOS system:

Click the Docker icon on the menu bar and select "Quit Docker Desktop".

  • Windows system:

Click the Docker icon on the taskbar and select "Quit Docker Desktop".

  1. Kill all Docker processes manually

If neither of the above two methods works, you can try to kill all Docker processes manually. You can get all running Docker processes using the following command:

$ docker container ls

will display some running containers. You can then kill all Docker processes using the following command:

$ docker kill $(docker ps -q)
  1. Uninstall Docker

If you don't need Docker at all, you can choose to uninstall it. You can uninstall Docker using the following command:

  • Ubuntu system:
$ sudo apt-get purge docker-ce docker-ce-cli containerd.io
  • CentOS system:
$ sudo yum remove docker-ce docker-ce-cli containerd.io
  • macOS System:

Select the "Uninstall" option of Docker Desktop.

  • Windows system:

Select the "Uninstall" option of Docker Desktop.

In short, the above are several ways to shut down Docker. Please choose the closing method that suits you according to your actual situation.

The above is the detailed content of Detailed explanation of how to properly shut down Docker. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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