gpt4 book ai didi

Docker Swarm - 更新时无法从私有(private)注册表中提取,仅适用于初始部署

转载 作者:行者123 更新时间:2023-12-02 11:32:23 29 4
gpt4 key购买 nike

我在执行更新或部署(在现有堆栈上)时遇到群体工作节点不更新镜像的问题。堆栈在创建时始终有效

This solution只适用于创造。

要重现该问题,请执行以下操作

1)创建一个容器,例如带有index.html的httpd,将其存储在private-registry.example.com/path/image

2)创建test.yml

version: '3.4'

services:
test:
# Use the build in the current pipeline
image: private-registry.example.com/path/image
deploy:
replicas: 3

3) 部署堆栈

docker login private-registry.example.com
docker stack deploy --with-registry-auth --compose-file=test.yml test

4)更新容器,更改一些文本

5) 重新部署堆栈

docker login private-registry.example.com
docker stack deploy --with-registry-auth --compose-file=test.yml test

Swarm 管理器将拥有最新的镜像,而 Swarm 节点则不会。

docker service ps test_test

ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
j9497jwolee4 test_test.1 private-registry.example.com/path/image swarm-slave-01.example.com Running Running 5 seconds ago
zsqxx3m0mpk3 \_ test_test.1 private-registry.example.com/path/image swarm-slave-01.example.com Shutdown Shutdown 7 seconds ago
sjjggcqmjcvo test_test.2 private-registry.example.com/path/image swarm-master.example.com Running Running 10 seconds ago
uyey60wv2vsc \_ test_test.2 private-registry.example.com/path/image swarm-slave-01.example.com Shutdown Rejected 20 seconds ago "No such image: private-registry..."
ttzvf4j3whk3 \_ test_test.2 private-registry.example.com/path/image swarm-slave-01.example.com Shutdown Rejected 25 seconds ago "No such image: private-registry..."
x77e3r46zl1j \_ test_test.2 private-registry.example.com/path/image swarm-master.example.com Shutdown Rejected 31 seconds ago "No such image: private-registry..."
5a7lywn6zycz \_ test_test.2 private-registry.example.com/path/image swarm-master.example.com Shutdown Rejected 36 seconds ago "No such image: private-registry..."
qp1acqgthl33 test_test.3 private-registry.example.com/path/image swarm-slave-02.example.com Running Running 11 seconds ago
osyn19o6c30j \_ test_test.3 private-registry.example.com/path/image swarm-master.example.com Shutdown Shutdown 12 seconds ago

解决方法这每次都会毫无问题地提取最新的图像。

docker login private-registry.example.com
docker stack rm test
docker stack deploy --with-registry-auth --compose-file=test.yml test

系统

Server Version: 18.06.1-ce
Operating System: Ubuntu 18.04.1 LTS

最佳答案

尽量不要使用 --resolve-image never 检查 docker 镜像摘要。看起来很有效。

docker stack deploy --prune --with-registry-auth --resolve-image never -c docker-compose.yml xxxx

关于Docker Swarm - 更新时无法从私有(private)注册表中提取,仅适用于初始部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52409904/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com