Home >Operation and Maintenance >Docker >What is the difference between stop and rm commands in docker?

What is the difference between stop and rm commands in docker?

青灯夜游
青灯夜游Original
2020-07-17 14:00:136411browse

Difference: The stop command is used to stop the container; and the rm command is a deletion command. If used directly, the corresponding container will be deleted. Note: docker stop first sends a SIGTERM signal to the container, allowing it to perform some operations within a certain period of time. If the container does not stop within this period, it sends a SIGKILL signal to forcibly kill the container.

What is the difference between stop and rm commands in docker?

The difference between stop and rm commands in docker

The stop command is used to stop the container.

docker stop: First send the SIGTERM signal to the container, allowing it to perform some operations within a certain period of time (default 10s). If the container does not stop during this period, send the SIGKILL signal to forcibly kill the container;

# 停止一个容器
$docker stop Name/ID

The rm command is a deletion command. If used directly, it will delete the corresponding container.

# 删除所有容器
$docker rm `docker ps -a -q`
# 删除单个容器; -f, --force=false; -l, --link=false Remove the specified link and not the underlying container; -v, --volumes=false Remove the volumes associated to the container
$docker rm Name/ID

Recommended tutorials: "docker tutorial", "PHP tutorial"

The above is the detailed content of What is the difference between stop and rm commands in 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