简体   繁体   English

Docker 图像推送到谷歌容器注册表不起作用

[英]Docker Image push to google container registry not working

When i push a image from a jenkins to gcr following error occurs: denied: Unable to write blob sha256当我将图像从 jenkins 推送到 gcr 时发生以下错误:被拒绝:无法写入 blob sha256

Even if i set the registry public it is not possible.即使我将注册表设置为公开也是不可能的。 The same error occurs出现同样的错误

I've been facing the same issue, and eventually solved it by removing the problematic Docker image layer, using the Console UI: https://console.cloud.google.com/storage/browser/artifacts ..appspot.com/containers/images/我一直面临着同样的问题,最终通过使用控制台 UI 删除有问题的 Docker 镜像层来解决它: https: //console.cloud.google.com/storage/browser/artifacts ..appspot.com/containers /图片/

Error message looks like:错误消息如下所示:

denied: Unable to write blob sha256:050eee1aec04cc914bf96e8f4dee7767510c2aca3816af6078ba6fbe3150920e

File name in the artifacts bucket will match exactly the blob name: sha256:050eee1aec04cc914bf96e8f4dee7767510c2aca3816af6078ba6fbe3150920e . artifacts 存储桶中的文件名将与 blob 名称完全匹配: sha256:050eee1aec04cc914bf96e8f4dee7767510c2aca3816af6078ba6fbe3150920e

Delete it, and try again.删除它,然后再试一次。 Hope it helps!希望能帮助到你!

My problem sounded likewise.我的问题听起来也一样。 First, I managed to temporary fix it with @michael-bouvy's solution above, by manual deleting the conflicting images.首先,我通过手动删除冲突的图像,设法使用上面@michael-bouvy 的解决方案临时修复它。

What have I done to fix it permanently is adding permission in GC IAM to the appropriate custom role of the identity that performs pushing.我为永久修复它所做的是在 GC IAM 中向执行推送的身份的适当自定义角色添加权限 Namely, in addition to existing ones:也就是说,除了现有的:

storage.buckets.get
storage.objects.create
storage.objects.get
storage.objects.list

I appended two more:我又附加了两个:

storage.objects.delete
storage.objects.update

Basically, these permissions just looked like those that required for temporary manual operations.基本上,这些权限看起来就像临时手动操作所需的权限。

Use the below command to push to Google container registry.使用以下命令推送到 Google 容器注册表。

withCredentials([file(credentialsId: 'google_crd_file', variable: 'filekey')]) {
                        sh """
                        gcloud auth activate-service-account --key-file=${filekey}
                        gcloud auth configure-docker
                        docker login -u _json_key --password-stdin https://eu.gcr.io < $filekey
                        docker push eu.gcr.io/<PROJECT_ID>/<IMAGE_NAME>:<VERSION>
                      """

"google_crd_file" is the ID of the credential stored in the Jenkins. “google_crd_file”是存储在 Jenkins 中的凭证的 ID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将 Docker 映像从 GKE 中运行的容器推送到 Google Container Registry - Push a Docker image to Google Container Registry from a container running in the GKE 无法将映像推送到 docker 容器注册表 - Unable to Push image to docker container registry Docker将Windows容器映像推送到Google容器注册表失败,并显示“清单无效” - Docker push Windows Container Image to Google Container Registry fails with “manifest invalid” 无法将 GCE 实例上的 Jenkins 中的 docker 映像推送到谷歌容器注册表 - Failing to Push docker image from Jenkins on GCE instance to google container registry Docker Google容器注册表 - Docker google container registry Google Cloud Container Registry拒绝来自docker push的连接 - Google Cloud Container Registry refuses connection from docker push 如何构建 docker 镜像并推送到 azure 容器注册表 - How to build docker image and push to azure container registry 构建 docker-compose 镜像并将其推送到容器注册表中 - Build and push docker-compose image into container registry 如何使用 Azure Pipeline 将 docker 映像“推送”到 Azure 容器注册表? - How to use Azure Pipeline to "Push" a docker image to Azure Container Registry? 使用 terraform 将 docker 镜像推送到 azure 容器镜像仓库 - Use terraform to push docker image to azure container registry
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM