docker服务更新vs docker堆栈使用现有堆栈进行部署 [英] docker service update vs docker stack deploy with existing stack

查看:134
本文介绍了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堆栈使用现有堆栈进行部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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