简体   繁体   English

本地开发和集群服务映像更新

[英]Local development and swarm service image update

We are using Docker Swarm on developers machines for development. 我们正在开发人员机器上使用Docker Swarm进行开发。 Docker services is using eg foo:beta image. Docker服务正在使用例如foo:beta映像。

When a developer builds a new feature for foo , he builds a new image of the container locally, under the same name (sha is different). 当开发人员为foo构建新功能时,他将以相同的名称(sha有所不同)在本地构建容器的新映像。

However, we are not being able to update the service to use the new image version. 但是,我们无法将服务更新为使用新的映像版本。 We tried 我们尝试了

docker service update --force --image <component>

w/o success. 没有成功。

We are running the latest edge docker build: 17.05.0-ce-rc1-mac8 (16582) 我们正在运行最新的Edge docker build:17.05.0-ce-rc1-mac8(16582)

The key is to use a local tag for images, that does not exist on remote repository. 关键是对图像使用本地标记,远程存储库中不存在该标记。 When Swarm can't find the image by given tag on remote repo, it will use the local one. 当Swarm无法通过远程仓库上的给定标签找到图像时,它将使用本地图像。

For that purpose, we tag all developer-related containers also with eg dev tag, that only exist on developers machine. 为此,我们还使用仅在开发人员机器上存在的dev标签来标记所有与开发人员相关的容器。 This way we can update the image and by forcing the service update, update the running code. 这样,我们可以更新映像并通过强制服务更新来更新正在运行的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM