What is the difference between stop and pause in docker?

WBOY
Release: 2022-07-14 14:53:21
Original
6556 people have browsed it

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 # 创建容器并运行
Copy after login

Pause and unpause

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

Stop and start

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

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...]
Copy after login

Instance

Pause the database container db01 to provide services.

docker pause db01
Copy after login

Restore database container db01 to provide services.

docker unpause db01
Copy after login

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...]
Copy after login

Example

Start the stopped container myrunoob

docker start myrunoob
Copy after login

Stop the running container myrunoob

docker stop myrunoob
Copy after login

Restart the container myrunoob

docker restart myrunoob
Copy after login
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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!