是否可以为容器的重启策略设置最大延迟超时? [英] Is it possible to set maximum delay timeout for restart policy for a container?

查看:51
本文介绍了是否可以为容器的重启策略设置最大延迟超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Docker码头中,它指出:

In docker docks it states:

在每次重新启动之前添加一个不断增加的延迟(从100毫秒开始,是以前的延迟的两倍),以防止服务器泛滥.这意味着守护程序将等待100 ms,然后等待200 ms,400、800、1600,依此类推,直到达到失败限制,或者当docker stop或docker rm -f容器时.

An ever increasing delay (double the previous delay, starting at 100 milliseconds) is added before each restart to prevent flooding the server. This means the daemon will wait for 100 ms, then 200 ms, 400, 800, 1600, and so on until either the on-failure limit is hit, or when you docker stop or docker rm -f the container.

假设我的容器在启动时连接到数据库.如果数据库服务器已关闭,则容器进程将退出并出现错误.如果数据库长时间离线,则重新启动延迟可能会增加到5分钟.

Let's say my container connects to database on startup. If database server is down, then container process exits with error. If database will be offline for a long time restart delay can grow to 5 minutes for example.

例如可以将最大延迟限制为10秒吗?

Is it possible to limit max delay to 10 seconds for example?

推荐答案

我认为您不能使用容器配置来做到这一点.

I don't think you can do that with a container configuration.

您可以直接在您的应用程序上实现此延迟吗?

Can you implement this delay directly on your application ?

这篇关于是否可以为容器的重启策略设置最大延迟超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆