Docker Swarm : docker stack 在未标记的图像上部署结果<none> [英] Docker Swarm : docker stack deploy results on untagged images <none>
问题描述
我正在使用 docker swarm mode host 将注册表中的一些图像部署到我的应用程序服务器中:
I'm deploying some images from my registry into my application server using docker swarm mode host :
我在注册表中的镜像是这样的(执行docker images
):
My image in the registry is looking like this (executing docker images
) :
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost:5000/myApp G02R00C09_myTag c1fc2242f9a0 2 hours ago 272MB
在 my docker compose file 下,我的服务如下所示:
Under my docker compose file , my service looks like this :
---
version: '3.4'
services:
ihm:
image: myRegistryServer:5000/myApp:G02R00C09_myTag
stdin_open: true
volumes:
- /opt/logs:/opt/logs
tty: true
ports:
- target: 80
published: 80
protocol: tcp
mode: host
deploy:
mode: global
placement:
constraints:
- node.labels.type == abc
healthcheck:
disable: true
-> 执行后 docker stack deploy
:
我的堆栈和服务运行良好(当我运行 docker stack ls
和 docker service ls
时,一切正常)
i got my stack and my service well running (when i run docker stack ls
and docker service ls
, everything is ok)
-> 但是在运行 docker images
时,我确实得到了我的图像 但带有 <none>
标签:
-> but when running docker images
, i do get my image but with <none>
tag:
image: myRegistryServer:5000/myApp <none>
推荐答案
这是正常的.使用 Swarm Stacks 时,它会将您的标签转换为该图像的 SHA256 并下载该特定 ID.这保证了每个节点都有相同的图像.如果它只依赖于标签,你可能会在 docker push
中重复使用标签,并且不同的节点可能会下载不同的图像.
This is normal. When using Swarm Stacks, it converts your tag into the SHA256 of that image and downloads that specific ID. This guarantees each node has the same image. If it only depended on the tag, you could potentially re-use the tag in a docker push
, and it's possible for different nodes to download different images.
您可以看到 docker service ls
或 docker stack ps
这篇关于Docker Swarm : docker stack 在未标记的图像上部署结果<none>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!