首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么我不能在我的云devshell中运行docker容器?

为什么我不能在我的云devshell中运行docker容器?
EN

Stack Overflow用户
提问于 2018-06-09 08:32:27
回答 1查看 564关注 0票数 0

我正在学习https://cloud.google.com/container-builder/docs/quickstart-docker的教程。我已经构建了镜像&它被推送到谷歌的gcr.io注册表。

代码语言:javascript
复制
$ gcloud auth configure-docker
gcloud credential helpers already registered correctly.

$ docker run --init gcr.io/foo-bar-111111/quickstart-image
Unable to find image 'gcr.io/foo-bar-111111/quickstart-image:latest' locally
docker: Error response from daemon: 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.
See 'docker run --help'.

$ docker-credential-gcr configure-docker
/home/wonderwoman/.docker/config.json configured to use this credential helper for GCR registries

$ docker run --init gcr.io/foo-bar-111111/quickstart-image
Unable to find image 'gcr.io/foo-bar-111111/quickstart-image:latest' locally
docker: Error response from daemon: 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.
See 'docker run --help'.

$ docker pull gcr.io/foo-bar-111111/quickstart-image:latest
Please login prior to pull:
error getting credentials - err: exit status 1, out: `docker-credential-gcr/helper: could not retrieve GCR's access token: credentials not found in native keychain`

我错过了什么?

EN

回答 1

Stack Overflow用户

发布于 2018-06-25 02:22:38

您正在将gcloud用作Docker credential helper

代码语言:javascript
复制
gcloud auth configure-docker

因此,您必须使用gcloud docker从docker注册表中docker pull您的映像。gcloud docker仍然在底层使用Docker,但在移交给Docker之前,会使用Container Registry凭证注入Docker客户端。

使用您的示例:

代码语言:javascript
复制
gcloud docker pull gcr.io/foo-bar-111111/quickstart-image:latest

您可能还必须使用sudo,生成完整的命令:

代码语言:javascript
复制
sudo gcloud docker pull gcr.io/foo-bar-111111/quickstart-image:latest
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50769894

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档