Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does docker close the container?

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to close the container by docker". Interested friends may wish to take a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "docker how to close the container"!

Generally, we can use docker stop to terminate a running container. In addition, the container automatically terminates when the application specified in the docker container terminates.

For example, a container with only one terminal is started, and when a user exits the terminal through the exit command or Ctrl+d, the created container terminates immediately. The container that terminates the state can be seen with the docker ps-a command.

Or use the following steps to specify how to stop the docker service.

Step 1: check the version of our operating system. Different operating system versions have different ways to stop docker services. Use lsb_release-a to check the version number. Here, take centos 6.5 as an example.

Step 2: before shutting down the docker service, we use the docker ps command to check whether there is a container running. We need to stop the container first. Stopping the service directly may cause the container exception.

Docker ps-- view the container that is running

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 is also available)

Change the way the service starts and shuts down after centos 7. 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)

View status on systemctl status docker-centos 7

At this point, I believe you have a deeper understanding of "how to close the container by docker". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report