`docker-credential-gcloud` not in system PATH

4/11/2018

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.

Running which docker-credential-gcloud returns docker-credential-gcloud not found.

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

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

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

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

-- ZaxR
docker
gcloud
google-cloud-platform
google-container-registry
google-kubernetes-engine

6 Answers

4/10/2019

I got the issue when I tried to SSH from Google Cloud Build into an Engine VM Instance, so I had

steps:
- name: 'gcr.io/cloud-builders/gcloud'
  args: ['compute', 'ssh',
         '--project', '$PROJECT_ID',
         '--zone', 'asia-southeast1-b',
         '--strict-host-key-checking=no',
         'username@instance-1',
         '--command' ,'sh start.sh'

My start.sh

#!/bin/sh

echo "Started: $(date --iso-8601=seconds)"

docker pull gcr.io/aaa/bbbc/cccc

echo "Finished: $(date --iso-8601=seconds)"

The issue was How to set PATH when running a ssh command?

https://unix.stackexchange.com/questions/332532/how-to-set-path-when-running-a-ssh-command

-- vanduc1102
Source: StackOverflow

2/10/2020

So I just faced the same problem where I am trying to pull an image from GCR to an GCP instance and want to share my solution.

I ran gcloud auth configure-docker and got the warning:

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.

I applied the accepted answer for this thread and ran gcloud components install docker-credential-gcr and got a long error:

ERROR: (gcloud.components.install) You cannot perform this action because this Cloud SDK installation is managed by an external package manager.
Please consider using a separate installation of the Cloud SDK created through the default mechanism described at: https://cloud.google.com/sdk/

When no solution was working, I uninstalled the Google provided google-cloud-sdk package that was installed via snap and instlled with distro specifice package manager, for me that is apt-get as instructed in the Installing Google Cloud SDK: Installation options page and re-ran the gcloud auth configure-docker and this time it solved my problem.

-- Fazle Rabbi
Source: StackOverflow

4/20/2018

It really seems to be something with the Homebrew Cask. I uninstalled the cask and then reinstalled the Google Cloud SDK by manually downloading the tar ball and running the packaged install script as described there.

Now docker-credential-gcloud is in my path:

$ which docker-credential-gcloud
/Users/moritz/google-cloud-sdk/bin/docker-credential-gcloud
-- anothernode
Source: StackOverflow

4/21/2018

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.

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

$ gcloud components install docker-credential-gcr

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

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.

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/.

Then:

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

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

I simply linked it to /usr/local/bin:

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

Then run:

$ docker-credential-gcr configure-docker

It should succeed.

-- Xiwen Li
Source: StackOverflow

4/11/2018

Never found a way to directly resolve the docker-credential-gcloud issue, but the following got me up and running again. WARNING: the following will delete all your existing docker images and install a bunch of gcloud utilities:

  1. gcloud components install docker-credential-gcr,
  2. Restart the terminal completely
  3. docker-credential-gcr configure-docker.
  4. screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty

  5. umount /var/lib/docker/overlay2

  6. rm -rf /var/lib/docker

  7. Restart the terminal completely.
-- ZaxR
Source: StackOverflow

12/13/2019

The new version of google-cloud-sdk has only docker-credential-gcr but not docker-credential-gcloud anymore. On the other hand one of my python packages always requested docker-credential-gcloud.

The solution was to symlink docker-credential-gcloud to docker-credential-gcr:

ln -s /path/to/google-cloud-sdk/bin/docker-credential-gcr /usr/local/bin/docker-credential-gcloud

ls -l /usr/local/bin | grep docker should now print:

...
docker-credential-gcloud -> /path/to/google-cloud-sdk/bin/docker-credential-gcr
...
-- Tobias Ernst
Source: StackOverflow