gpt4 book ai didi

docker - 为什么我无法在我的云 devshell 中运行 docker 容器?

转载 作者:行者123 更新时间:2023-12-02 21:16:14 25 4
gpt4 key购买 nike

我正在关注 https://cloud.google.com/container-builder/docs/quickstart-docker 上的教程.我已经构建了图像并将其推送到 Google 的 gcr.io 注册表。

$ 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`

我错过了什么?

最佳答案

您正在使用 gcloud作为 Docker credential helper :

gcloud auth configure-docker

所以你必须使用 gcloud dockerdocker pull您来自 docker 注册表的图像。 gcloud docker仍然在底层使用 Docker,但在移交给 Docker 之前使用 Container Registry 凭据注入(inject) Docker 客户端。

使用您的示例:
gcloud docker pull gcr.io/foo-bar-111111/quickstart-image:latest

您可能必须使用 sudo同样,制作完整的命令:
sudo gcloud docker pull gcr.io/foo-bar-111111/quickstart-image:latest

关于docker - 为什么我无法在我的云 devshell 中运行 docker 容器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50769894/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com