docker服务更新vs docker堆栈使用现有堆栈进行部署

编程入门 行业动态 更新时间:2024-10-11 09:30:01
本文介绍了docker服务更新vs docker堆栈使用现有堆栈进行部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在使用docker stack deploy部署了一组服务后,我不确定是否使用docker swarm模式命令来更新现有服务. 据我了解,每个服务在创建时都固定在映像的SHA256摘要中,因此,如果您重建并推送映像(具有相同标签)并尝试运行docker service update,则不会更新服务映像(即使SHA256不同).相反,如果再次运行docker stack deploy,则所有服务都将使用新映像进行更新. 我也通过使用docker service update --image repository/image:tag <service>来更新了服务映像.这是这些命令的正常行为,还是我不了解的东西?

I have a doubt in using docker swarm mode commands to update existing services after having deployed a set of services using docker stack deploy. As far I understood every service is pinned to the SHA256 digest of the image at the time of creation, so if you rebuild and push an image (with same tag) and you try to run a docker service update, service image is not updated (even if SHA256 is different). On the contrary, if you run a docker stack deploy again, all the services are updated with the new images. I managed to update the service image also by using docker service update --image repository/image:tag <service>. Is this the normal behavior of these commands or is there something I didn't understood?

我正在使用Docker 17.03.1-ce

I'm using Docker 17.03.1-ce

推荐答案

Docker堆栈部署文档说: 从群集上的compos或dab文件创建和更新堆栈.必须针对管理器节点运行此命令." 因此,您描述的行为符合预期.

Docker stack deploy documentation says: "Create and update a stack from a compose or a dab file on the swarm. This command has to be run targeting a manager node." So the behaviour you described is as expected.

Docker服务更新文档不清楚,但是你自己说它仅与--image repository/image:tag <service>一起运行,因此该标志对于更新图像是必需的.

Docker service update documentation is not so clear but you yourself said it only runs with --image repository/image:tag <service> so the flag is necessary to update the image.

您可以通过两种方式来完成所需的工作.

You have two ways to accomplish what you want.

更多推荐

docker服务更新vs docker堆栈使用现有堆栈进行部署

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

发布评论

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

>www.elefans.com

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