Docker Swarm:未标记图像上的Docker堆栈部署结果<;无>;
我正在使用docker swarm模式hos将注册表中的一些映像部署到我的应用程序服务器中t: 我在注册表中的图像如下所示(正在执行Docker Swarm:未标记图像上的Docker堆栈部署结果<;无>;,docker,docker-compose,dockerfile,docker-swarm,docker-registry,Docker,Docker Compose,Dockerfile,Docker Swarm,Docker Registry,我正在使用docker swarm模式hos将注册表中的一些映像部署到我的应用程序服务器中t: 我在注册表中的图像如下所示(正在执行docker images): 在“我的docker撰写文件”下,我的服务如下所示: --- version: '3.4' services: ihm: image: myRegistryServer:5000/myApp:G02R00C09_myTag stdin_open: true volumes: - /opt/lo
docker images
):
在“我的docker撰写文件”下,我的服务如下所示:
---
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
时,一切正常)
->但是当运行docker images
时,我确实会使用标签获取我的图像:
image: myRegistryServer:5000/myApp <none>
图像:myRegistryServer:5000/myApp
这是正常现象。使用Swarm堆栈时,它会将您的标记转换为该图像的SHA256,并下载该特定ID。这保证每个节点具有相同的图像。如果它仅依赖于标记,则可以在docker push
中重新使用标记,并且不同的节点可以下载不同的图像
您可以看到docker service ls
或docker stack ps
中使用的标记您是如何构建映像的(用于构建映像的命令)?另外,请尝试curl myRegistryServer:5000/v2/myApp/tags/list-v
查看注册表是否显示了所需的标记。我使用ansible的docker_图像模块构建了它,它会在注册表中成功标记图像curl
显示了什么?应该是这样。>GET/ihm/tags/list HTTP/1.1>用户代理:curl/7.29.0>主机:myResgitryServer:5000>接受:/>prune
命令,如docker image prune--help
以及我使用日常任务自动修剪所有节点上所有未使用的图像的示例:
image: myRegistryServer:5000/myApp <none>