`docker-credential-gcloud` not in system PATH

On MacOS

Step 1:

Install gcloud and docker-credential-gcr, following this tutorial

Step 2:

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

Step 3:

$ rm -rf ~/.docker

Step 4:

$ docker-compose build --pull

Finished!


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.


Just had the same issue on Windows, running Docker with Linux containers, Docker engine v19.03.8. Using docker compose. I do not use gcloud for my dockerfiles...

DT1001 dockerpycreds.errors.InitializationError: docker-credential-gcloud not installed or not available in PATH

  1. Option 1: Edit the docker configuration file and remove all gcloud entries from there.

    • Windows c:/Users/<your account>/.docker/config.json

    • Linux & MacOS ~/.docker/config.json

  2. Option 2: Go to Troubleshoot -> Reset to factory defaults.

After this my docker compose was creating containers and running the images without any issues.