大网数据广告活动
服务器运维问答

pushing an image with two tags to gcr.io results in two different images

· 52CE 我爱测

I'm doing the following: docker build -t gcr.io/projid/imgname:333 -t gcr.io/projid/imgname:latest . docker login -u _json_key -p "$(cat /secrets/service-account.json)" https://gcr.io docker push gcr.io/projid/imgname:333 docker …

问题原文

原帖链接 · Marcel Tricolici · CC BY-SA 3.0

I'm doing the following:

docker build -t gcr.io/projid/imgname:333 -t gcr.io/projid/imgname:latest .

docker login -u _json_key -p "$(cat /secrets/service-account.json)" https://gcr.io

docker push gcr.io/projid/imgname:333

docker push gcr.io/projid/imgname:latest

Output of 1st push command:

Pushing to google container registry ...
The push refers to a repository [gcr.io/projid/imgname]
24af4f7c7118: Preparing
17b0972980d8: Preparing
6d6a6425aacb: Preparing
809c8c0dd73c: Preparing
e8d45b8ab3ca: Preparing
e8fa134cb7b8: Preparing
7cbcbac42c44: Preparing
e8fa134cb7b8: Waiting
7cbcbac42c44: Waiting
809c8c0dd73c: Layer already exists
e8d45b8ab3ca: Layer already exists
7cbcbac42c44: Layer already exists
e8fa134cb7b8: Layer already exists
17b0972980d8: Pushed
24af4f7c7118: Pushed
6d6a6425aacb: Pushed
333: digest: sha256:dae8cf914ba49928e6f0a34f6740802403813e6d10aa1c1d448a62ce9bb69066 size: 1779

Output of 2nd push command:

Pushing to google container registry ...
The push refers to a repository [gcr.io/projid/imgname]
24af4f7c7118: Preparing
17b0972980d8: Preparing
6d6a6425aacb: Preparing
809c8c0dd73c: Preparing
e8d45b8ab3ca: Preparing
e8fa134cb7b8: Preparing
7cbcbac42c44: Preparing
e8fa134cb7b8: Waiting
7cbcbac42c44: Waiting
e8d45b8ab3ca: Layer already exists
809c8c0dd73c: Layer already exists
24af4f7c7118: Layer already exists
17b0972980d8: Layer already exists
6d6a6425aacb: Layer already exists
7cbcbac42c44: Layer already exists
e8fa134cb7b8: Layer already exists
latest: digest: sha256:4f57375919829982741d095f8917306fe0c1410e115d030179bae4b8e4299c30 size: 1742

Question: Why the same image with two tags results in two different images in google container registry?

已采纳解答

原帖链接 · Doru C. · CC BY-SA 3.0

You are certainly pushing two image tags. I suggest building with a single tag, then adding the second one and pushing the image tags one by one. If the second one adds a new digest is a GCR bug. I have ran into this bug and solved by deleting the repository so it gets re-created at the next push. In my configuration the Docker version was also a factor. Version 17.04.0-ce, build 4845c56 would trigger the extra digest while version 17.03.1-ce, build c6d412e would work fine.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-01-24)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。