Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "gracefully stop" mean?

Tags:

docker

I'm trying out Docker and came across docker container stop <hash> # Gracefully stop the specified container

I'm not asking about the difference between docker stop and docker kill. I'm wondering about the term "gracefully"

What does "gracefully stop" mean in this context?

like image 335
Jin Lee Avatar asked May 08 '19 06:05

Jin Lee


People also ask

What is graceful stop?

A graceful shutdown is when a computer is turned off by software function and the operating system (OS) is allowed to perform its tasks of safely shutting down processes and closing connections. A hard shutdown is when the computer is forcibly shut down by interruption of power.

What is difference between docker kill and stop?

To terminate a container, Docker provides the docker stop and docker kill commands. Both the docker kill and docker stop commands look similar, but their internal execution is different. The docker stop commands issue the SIGTERM signal, whereas the docker kill commands sends the SIGKILL signal.

How do I stop docker from running in the background?

Note that pressing `Ctrl+C` when the terminal is attached to a container output causes the container to shut down.

Does restarting docker kill containers?

For a major version upgrade, one has to tear down all running containers. With a restart policy of always , however, the containers will be restarted after the docker daemon is restarted after the upgrade.


1 Answers

Your question is related to the difference between SIGTERM and SIGKILL.

SIGTERM: When a process receives this signal, it has the chance to perform cleanup. That's the so-called "graceful" exit; it corresponds to docker stop.

SIGKILL: The process doesn't even know it has received this signal and it has no chance to ignore or do anything about it. The process directly exits. That's the so-called "not graceful" exit; it corresponds to docker kill.

For further details look at this topic.

like image 56
atline Avatar answered Oct 27 '22 00:10

atline