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
时,我确实得到了我的图像 但是
标签:
-> 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屋!