如何关闭Docker,好像未设置Live Restore?
我已经为大多数Docker主机设置了Live Restore,以支持光滑的次要版本升级,但文档指出此功能不适合主要版本升级。因此,问题是如何关闭Dockerd和所有容器,就好像Live Restore是不是设置吗?
当然,我可以在所有容器上循环以一对一的方式将它们关闭,但是我猜Dockerd使用了不同的过程。当它收到关闭信号后,它肯定可以避免启动新容器。外部循环不能。更不用说下一个Docker版本可能会引入必须考虑的新功能/集成。必须有一些“码头风格”的方法来做到这一点。
I have set live-restore for most Docker hosts to support smooth minor version upgrades, but the documentation states that this feature is not suitable for major version upgrades. So the question is how to shut down dockerd and all containers, as if live-restore was not set?
Of course I can loop over all containers to shut them down one-by-one, but I would guess that dockerd uses a different procedure. Surely it can avoid starting new containers once it has received the signal to shutdown. The external loop cannot. Not to mention that the next Docker version might introduce new features/integrations that have to be taken into account. There has to be some "docker-style" way to do this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想我自己弄清楚了:
如果我错了,请纠正我。
I guess I figured it out myself:
Correct me if I am wrong.
我想拥有某种
Systemctl stopall docker
,当Live Restore处于活动状态时,它会停止守护程序和容器。在某些情况下,它肯定会很有用。不幸的是,似乎没有一种暂时选择加入非live-Restore行为的方法。相反,我使用:Docker PS -Q | Xargs Docker Kill&& SystemCtl Stop Docker
在杀死所有容器和停止可以启动容器的码头之间有一个很小的时间窗口,因此它并不完美。
I would like to have some sort of
systemctl stopall docker
that stopped the daemon and the containers when live-restore is active. It certainly would be useful in some situations. Unfortunately there does not appear to be a way to opt-in to non-live-restore behavior temporarily. Instead I use:docker ps -q | xargs docker kill && systemctl stop docker
There is a very small window of time between killing all the containers and stopping docker that a container can be started, so its not perfect.