The command to exit docker is "service docker stop" or "systemctl stop docker"; the "docker stop" command is used to exit a running container, and the "stop docker" command is used to exit the docker service.
The operating environment of this tutorial: linux7.3 system, docker-1.13.1 version, Dell G3 computer.
What command should I enter to exit docker?
Step 1: Check the version of our operating system. The method of stopping the docker service varies with different operating system versions. Similarly, use lsb_release -a to check the version number. This machine is centos 6.5
Step 2: Before closing the docker service, we use the docker ps command to check whether there are currently containers. It is running. You need to stop the container first. Stopping the service directly may cause container exceptions. As shown in the figure, we stopped the running container
docker ps----View the running container
docker stop container ID----stop container
Step 3: Since the operating system version queried above is centos 6.5, we use service docker stop to stop the container service (/etc/init .d/docker stop can also be used)
After centos 7, to change the startup and shutdown method of the service, you can use the command systemctl stop docker to shut down
Step 4 : Check the current container service status service docker status (or /etc/init.d/docker status)
systemctl status docker---check the status on centos 7
Recommended learning: "docker video tutorial"
The above is the detailed content of What command should I enter to exit docker?. For more information, please follow other related articles on the PHP Chinese website!