我应该使用哪一个?码头工人杀死或码头工人停止? [英] Which one should i use? docker kill or docker stop?
问题描述
如果容器中运行的进程无法停止, docker stop
会失败吗??如果我使用 docker kill
,可以保存容器内未保存的数据。与 docker kill
相比, docker stop
耗时吗??我想关闭容器,但又不丢失任何数据(没有高延迟才能完成终止或停止过程)。
Will docker stop
fail if processes running inside the container fail to stop?? If i use docker kill
, can unsaved data inside the container be preserved. Is docker stop
time consuming compared to docker kill
?? I want to do a shutdown of the container but without loosing any data(without high latency to complete kill or stop process).
推荐答案
行参考:
Line reference:
docker stop
:停止正在运行的容器(发送SIGTERM, [...]宽限期后,然后SIGKILL
)。[...]容器内的主进程将
接收SIGTERM,并在宽限期后接收SIGKILL。 [强调我的]
docker stop
: Stop a running container (send SIGTERM, and then SIGKILL
after grace period) [...] The main process inside the container will
receive SIGTERM, and after a grace period, SIGKILL. [emphasis mine]
docker kill
:杀死正在运行的容器(发送SIGKILL或指定的
信号)[...]容器内的主进程将发送
SIGKILL或使用选项--signal指定的任何信号。 [强调我的]
docker kill
: Kill a running container (send SIGKILL, or specified
signal) [...] The main process inside the container will be sent
SIGKILL, or any signal specified with option --signal. [emphasis mine]
您可以从此帖子中获取更多信息:https://superuser.com/questions/756999/whats-the-difference-between-docker-stop-and-docker-杀死
You can get more info from this post: https://superuser.com/questions/756999/whats-the-difference-between-docker-stop-and-docker-kill
这篇关于我应该使用哪一个?码头工人杀死或码头工人停止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!