docker restart

编程入门 行业动态 更新时间:2024-10-28 04:15:08
本文介绍了docker restart_policy on-failure和any之间有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在docker swarm v3文档中,可以使用3种不同的重启策略条件。很明显,无条件的作用是什么,但是我想知道失败和是任何。

In the docker swarm v3 docs, there are 3 different restart policy conditions that can be used. It's obvious what the none condition does, but I was wondering what the difference between on-failure and any is specifically.

这是

推荐答案

发生故障策略将处理具有非零代码的容器的任何存在时间。 any 策略涵盖了所有其他情况,但是只能在守护程序重新启动时进行处理,具体取决于容器的停止方式(例如,使用 docker故意停止容器停止不会导致立即重启)。

The on-failure policy handles any time a container exist with a non-zero code. The any policy covers any other scenarios, but may only be handled on daemon restart depending on how the container was stopped (e.g. intentionally stopping a container with docker stop does not result in an immediate restart).

有关更多详细信息,请参见此文档: docs.docker/config/containers/start-containers-automatically/

See this documentation for more details: docs.docker/config/containers/start-containers-automatically/

注意:我不建议在群集模式下运行的容器重新启动策略。我见过各种情况,例如主机内存不足,群集模式和docker引擎都会尝试重新启动容器,最好让群集模式在另一个主机上重新创建新容器。

Note: I do not recommend a restart policy for containers running within swarm mode. I've seen scenarios, e.g. host out of memory, where both swarm mode and the docker engine attempt to restart the container and it's best to let swarm mode recreate a new container, possibly on another host.

更多推荐

docker restart

本文发布于:2023-11-25 22:19:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1631581.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:docker   restart

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!