本文介绍了`docker-credential-gcloud` 不在系统路径中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在对 gcloud 和 docker 进行最新更新后,我无法访问我的 google 容器存储库中的图像.在本地运行:gcloud auth configure-docker 按照更新 gcloud 后的说明,我收到以下消息:

After the latest updates to gcloud and docker I'm unable to access images on my google container repository. Locally when I run: gcloud auth configure-docker as per the instructions after updating gcloud, I get the following message:

WARNING: `docker-credential-gcloud` not in system PATH.
gcloud's Docker credential helper can be configured but it will not work until this is corrected.
gcloud credential helpers already registered correctly.

运行 which docker-credential-gcloud 返回 docker-credential-gcloud not found.

我没有其他与 gcloud 相关的路径问题,而且我一生都无法弄清楚如何将 docker-credential-gcloud 安装/添加到路径.这是我安装的内容(通过 gcloud version 显示):

I have no other gcloud-related path issues and for the life of me can't figure out how to install/add docker-credential-gcloud to path. Here's what I have installed (shown via gcloud version):

Google Cloud SDK 197.0.0
beta 2017.09.15
bq 2.0.31
container-builder-local
core 2018.04.06
docker-credential-gcr
gsutil 4.30

我还有 Docker CE 版本 18.03.0-ce-mac60 (23751).

I also have Docker CE Version 18.03.0-ce-mac60 (23751).

这是我的 $PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Here's my $PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

我还在原始 gcloud 安装上运行了 source/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc.

I also ran source /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc on original gcloud install.

推荐答案

注意:以下所有docker-credential-gcr都可以替换为docker-credential-gcloud.我认为这只是 gcloud 的不同版本,我可能错了.

Notice: All docker-credential-gcr below can be replaced with docker-credential-gcloud. I think it is just different versions of gcloud, I might be wrong.

我也使用 Homebrew Cask 安装 gcloud.我用

I used Homebrew Cask to install gcloud too. I installed docker-credential-gcr with

$ gcloud components install docker-credential-gcr

然后就像你说的,which docker-credential-gcr 没有给你任何东西.

And then like you said, which docker-credential-gcr doesn't gave you anything.

所以我运行 which gcloud 发现在 /usr/local/bin 中有一个指向 gcloud 的符号链接.当您首先安装 gcloud 时,此符号链接由 Homebrew 创建.现在 docker-credential-gcr 不是由 Homebrew 安装的,而是由 gcloud 本身安装的,所以没有符号链接.

So I ran which gcloud to find there is a symlink to gcloud in /usr/local/bin. This symlink is created by Homebrew when you installed gcloud at first place. Now docker-credential-gcr wasn't installed by Homebrew but by gcloud itself, so there isn't a symlink.

我打电话给 readlink/usr/local/bin/gcloud 并发现 gcloud 安装在 /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/.

I called readlink /usr/local/bin/gcloud and found out gcloud is installed in /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/.

那么:

$ ls /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin

在那里你应该看到 docker-credential-gcr 列出在那里.

There you should see docker-credential-gcr listed there.

我只是将它链接到 /usr/local/bin:

$ ln -s
    /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/docker-credential-gcr
    /usr/local/bin/

然后运行:

$ docker-credential-gcr configure-docker

应该会成功.

这篇关于`docker-credential-gcloud` 不在系统路径中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 03:01