In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.