【问题标题】:unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request未经授权:您没有执行此操作所需的权限,并且您的凭据可能无效。验证您的请求
【发布时间】:2021-06-21 12:36:43
【问题描述】:

我正在尝试将 Strapi docker 容器推送到谷歌云,以将其用于谷歌云运行。

为了推送,我运行了以下命令

sudo docker tag strapi/strapi gcr.io/project_name/strapi

激活服务帐号

gcloud auth activate-service-account service_user --key-file=service_user.json

配置docker gcloud auth configure-docker

将身份验证添加到 docker 配置

gcloud auth list
                  Credentialed Accounts
ACTIVE  ACCOUNT
*       service_account
        other_account

为服务帐号提供以下权限

  1. 容器注册服务
  2. 存储管理员

[错误] 推送图片

Using default tag: latest
The push refers to repository [gcr.io/project_name/strapi]
65bc6b54035e: Preparing 
983f2d44d014: Preparing 
a791c7d660b3: Preparing 
76269cc2f2b5: Preparing 
cbff660b7bdc: Preparing 
4f92f3f27665: Waiting 
fdba6a5d9dd7: Waiting 
07700abd910e: Waiting 
edfb8ee7c346: Waiting 
aa817488a0dd: Waiting 
74825a980b6d: Waiting 
1fb0a31fe7c2: Waiting 
unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication```

【问题讨论】:

  • 你使用 docker 来推送你的镜像。 Docker 不使用 ADC(应用程序默认凭据)。因此,您必须按照错误中提供的链接授予 Docker 访问您的容器注册表的权限。
  • 我知道我做错了什么,我在推送图像时使用sudo,这使它在我的配置位于 ~/.docker/config.js 中的 sudo 用户上查找权限跨度>

标签: docker google-cloud-platform


【解决方案1】:

我犯的错误是将sudodocker push gcr.io/project_name/image_name 一起使用。删除 sudo 后,该命令运行良好。

【讨论】:

    猜你喜欢
    • 2019-02-10
    • 2020-05-03
    • 1970-01-01
    • 2021-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-10
    • 2015-03-27
    相关资源
    最近更新 更多