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

What is the difference between stop and pause in docker?

WBOY
WBOYOriginal
2022-07-14 14:53:216663browse

The difference between stop and pause in docker: 1. The stop command is used to stop a running container, and the pause command is used to pause all processes in the container; 2. Using the stop command, the main process in the container will be in the specified It will be killed within the specified time, which defaults to ten seconds. Using the pause command will suspend all processes in the specified container.

What is the difference between stop and pause in docker?

The operating environment of this tutorial: linux7.3 system, docker version 19.03, Dell G3 computer.

What is the difference between stop and pause in docker

Create a container and run it

docker run # 创建容器并运行

Pause and unpause

docker pause # 暂停运行容器
docker unpause # 取消暂停

Stop and start

docker stop # 停止运行容器
docker start # 开始运行容器

The difference between docker pause and docker stop

  • #The docker pause command suspends all processes in the specified container

  • docker stop The main process in the container will be killed within the specified time, the default is 10s

  • docker pause: Pause all processes in the container.

  • docker stop: Stop a running container

##Expand knowledge

docker pause: Pause all processes in the container.

docker unpause: Resume all processes in the container.

Syntax

docker pause CONTAINER [CONTAINER...]
docker unpause CONTAINER [CONTAINER...]

Instance

Pause the database container db01 to provide services.

docker pause db01

Restore database container db01 to provide services.

docker unpause db01

docker start: Start one or more stopped containers

docker stop: Stop a running container

docker restart: Restart the container

Syntax

docker start [OPTIONS] CONTAINER [CONTAINER...]
docker stop [OPTIONS] CONTAINER [CONTAINER...]
docker restart [OPTIONS] CONTAINER [CONTAINER...]

Example

Start the stopped container myrunoob

docker start myrunoob

Stop the running container myrunoob

docker stop myrunoob

Restart the container myrunoob

docker restart myrunoob

Recommended learning: "

docker video tutorial"

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