首页 > 解决方案 > 即使使用 --with-registry-auth,Docker 堆栈部署也不会从私有 resgistry 中提取图像

问题描述

我正在使用以下命令使用 docker stack 和 docker-compose 文件部署容器

docker stack deploy --with-registry-auth -c compose.yml app

初始部署成功,但是当我重新运行命令时,容器出现以下错误:

Updating service sparkful_nginx (id: <some_id>)
image <image_url> could not be accessed on a registry to record
its digest. Each node will access <image_url> independently,
possibly leading to different nodes running different
versions of the image.

PS:我正在使用 GitHub 注册表。

标签: dockerdocker-compose

解决方案


您可能需要在每台机器上执行 docker login,然后

docker login -u username -p password registry.hub.Docker.com/myproject 
docker stack deploy -c Docker-swarm.yml test --with-registry-auth

正如这里所解释的

参考: http: //littlebigextra.com/installing-docker-images-private-repositories-docker-swarm/

使用 Github Registry 进行更新 ,目前这是一个已知问题。 https://github.com/containerd/containerd/issues/3291#issuecomment-579804848


推荐阅读