如何关闭Docker,好像未设置Live Restore?

发布于 2025-01-27 05:32:48 字数 269 浏览 3 评论 0原文

我已经为大多数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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

长不大的小祸害 2025-02-03 05:32:48

我想我自己弄清楚了:

  • edit/etc/docker/daemon.json将live-restore设置为false
  • run“ systemctl reload docker”或向Dockerd Run发送
  • “ SytemCtl stop docker docker.socket”或类似于关闭Docker像往常一样,

如果我错了,请纠正我。

I guess I figured it out myself:

  • edit /etc/docker/daemon.json to set live-restore to false
  • run "systemctl reload docker" or send a SIGHUP to dockerd
  • run "systemctl stop docker docker.socket" or similar to shutdown docker as usual

Correct me if I am wrong.

当梦初醒 2025-02-03 05:32:48

我想拥有某种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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文