为什么docker swarm不会将最新的标签推送到Google Container Registry?

时间:2018-04-26 06:04:04

标签: docker google-cloud-platform docker-swarm google-container-registry

我想知道docker swarm和GCR是否存在问题,或者GCR现在是否遇到了一些延迟。

我将新标记的图像推送到GCR,但是我的群集上的节点无法进行更改。他们从GCR中提取了完全相同图像的其他五个版本。

这是我的推动:

docker push gcr.io/me/myimage:0.0.5
The push refers to repository [gcr.io/me/myimage]
310bd8913b53: Layer already exists 
20d2e739cce3: Layer already exists 
328545f2b7b7: Layer already exists 
087a146ecf85: Layer already exists 
78da480ad576: Layer already exists 
7ff93b2699ab: Layer already exists 
f58cfeda9e5f: Layer already exists 
33aed7748ee3: Layer already exists 
0e0b4ee1c6dc: Layer already exists 
ff57bdb79ac8: Layer already exists 
6e5e20cbf4a7: Layer already exists 
86985c679800: Layer already exists 
8fad67424c4e: Layer already exists 
0.0.5: digest: sha256: ... size: 3053

然后尝试扩展到新图像显示:

$ docker service scale is_app=1
is_app scaled to 1
overall progress: 0 out of 1 tasks 
1/1: No such image: gcr.io/me/myimage:0.0.5 

如果我重新创建堆栈并在myimage服务上运行docker service ps --no-trunc,我会...

docker service ps is_app --no-trunc
ID                          NAME                IMAGE                          NODE                DESIRED STATE       CURRENT STATE                     ERROR                                           PORTS
6accpgxjdfq936vsoco8qa9cc   is_app.1            gcr.io/me/myimage:0.1.0   app-swarm-w1        Ready               Rejected less than a second ago   "No such image: gcr.io/me/myimage:0.1.0"   
e69xzn1m9vp6kcj0m9gy95fvd    \_ is_app.1        gcr.io/me/myimage:0.1.0   app-swarm-m0        Shutdown            Rejected 20 seconds ago           "No such image: gcr.io/me/myimage:0.1.0"   
gojagqi0vjh5y088xgn99xbg9    \_ is_app.1        gcr.io/me/myimage:0.1.0   app-swarm-m0        Shutdown            Rejected 25 seconds ago           "No such image: gcr.io/me/myimage:0.1.0"   
ya3f0g8lji4522em0ge78gfg9    \_ is_app.1        gcr.io/me/myimage:0.1.0   app-swarm-m0        Shutdown            Rejected 30 seconds ago           "No such image: gcr.io/me/myimage:0.1.0"   
les1emnyzvghzjlxa5huysa9n    \_ is_app.1        gcr.io/me/myimage:0.1.0   app-swarm-m0        Shutdown            Rejected 36 seconds ago           "No such image: gcr.io/me/myimage:0.1.0"   

然而,如果我在机器中运行docker-machine ssh并运行gcloud container images list-tags gcr.io/me/myimage:0.0.5,则会显示:

DIGEST        TAGS   TIMESTAMP
007300edd521  0.0.5  2018-04-26T05:42:36
46a297a45f61  0.0.4  2018-04-26T00:31:35
ff8160e40214  0.0.3  2018-04-26T00:22:32
ec4517dbae67  0.0.2  2018-04-25T23:09:53
b9f3400a298c  0.0.1  2018-04-25T20:02:55
0244b39f532e  0      2018-04-24T20:01:51

所以它存在。为docker swarm传播需要多长时间才能获取它?这是正常的吗?有一些解决方法吗?

1 个答案:

答案 0 :(得分:1)

显然我忘了将--with-registry-auth传递给docker stack deploy,这会影响与GCR的连接。这解决了这个问题。