Search code examples
dockergoogle-cloud-platformgcloudgoogle-kubernetes-enginegoogle-container-registry

`docker-credential-gcloud` not in system PATH


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.


Solution

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