我已阅读以下内容: Re-deploying docker stack not updating containers with latest ,正如本期所述:
But I still want to use latest anyway, and have swarm check for latest sha digest (or any tag that I reuse every deploy)
Turns out this should work as of 17.06 out of the box. docker stack deploy should pull sha digests from the registry each time. This changed a bit since then, and bugs were fixed, so this is where we're at today:
docker stack deploy -c stack.yml mystack with a 18.06 client and server versions, will turn the latest tag (or lack of tag) in the stack.yml into a sha and send that to the service update command. If the sha digests match, and nothing else in yaml has changed, service will not replace the task.
Stack deploy now has docker stack deploy --resolve-image options, which defaults to always so it should always check the sha digest. never means it will not compare digests from registery or local cash (even if the node image cache has a different version). I can't figure out what changed does.
但是为什么我的测试仍然失败:
我更新了映像(仍使用最新标记)并执行docker stack deploy -c test.yml test
,但是我的服务没有重新启动以使用新映像来运行容器。
我误解了这个问题吗?
这是test.yml:
version: "3.7"
services:
testapp:
image: testimage
这是docker版本:
docker-ce-cli-19.03.5-3.el7.x86_64
docker-ce-19.03.5-3.el7.x86_64