In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how containers in Docker implement the method of viewing termination deletion. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
The details are as follows:
Views
docker ps
There are some main parameters to say
1. Without parameters, it means to view the currently running container
2. -a, View all containers including stopped containers
3. -l, view newly created containers
4. -n=x, see the last x containers created
List the docker ps results
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
What do these represent?
CONTAINER ID: Container ID, uniquely identifies the container
IMAGE: The image used to create the container
COMMAND: The command that runs last in the container
CREATED: Time the container was created
STATUS: Status of the container (you will see UPXXX, indicating the operational status)
PORTS: Port number open to the public
NAMES: container name (also unique, docker is not allowed to create containers with the same container name)
start
We will see some containers with CREATED status when using docker ps -a, so we need to start the container with docker start container name or container ID. However, it should be noted that after using this command, the container enters the running state. When the container completes the task, it will exit itself and enter the stopped state. If you need to start the start command again
Here is a parameter that allows the container to automatically restart after exiting
--restart This parameter checks the container's exit code and determines whether to restart the container based on it.
Don't try this example easily, this will keep outputting hello world, and ctrl+C will not stop this (think about it later, why didn't you stop?????)
Finally, I opened another terminal and typed
docker stop docker_restart terminates the container
termination
It also said that the order was
docker stop Container name or container ID
The docker stop command sends a SIGTERM signal to the container process, and the default behavior is container exit.
If you want to forcibly stop a container, it is best to use the docker kill command.
It sends a SIGKILL signal (uncatchable)
delete
We cannot delete a running container, we must docker stop or docker kill before we can delete it.
Command: docker rm container name
Of course, if we add-f, we can also delete a running container.
How to delete all containers at once docker doesn't give the relevant command, but we can do this
-q is list container ID only
Thank you for reading! About "Docker container how to view the method of termination deletion" This article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!
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.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.