`docker-credential-gcloud` not in system PATH
Solution 1
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.
Solution 2
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
-
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
Option 2: Go to Troubleshoot -> Reset to factory defaults.
After this my docker compose was creating containers and running the images without any issues.
Solution 3
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!
Solution 4
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:
gcloud components install docker-credential-gcr
,- Restart the terminal completely
docker-credential-gcr configure-docker
.screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
umount /var/lib/docker/overlay2
rm -rf /var/lib/docker
- Restart the terminal completely.
Solution 5
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
...
ZaxR
Updated on July 05, 2022Comments
-
ZaxR almost 2 years
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
returnsdocker-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. -
jumand about 6 yearsThis answer almost worked for me, but needed a tweak. The symlink step seemed to have an outdated/typo in it. It referenced
docker-credential-gcr
instead ofdocker-credential-gcloud
. Updating that step as below worked for me.$ ln -s /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin/docker-credential-gcloud /usr/local/bin/
-
Xiwen Li about 6 yearsThank you Jumand for noticing it. It was pure type. I am having it corrected.
-
Xiwen Li about 6 yearsI just checked. On my machine it is docker-credential-gcr. And I ran
gcloud components list
docker-credential-gcloud isn't there. I don't know what's going on. -
Maximilian about 6 years@jumand - I think that
docker-credential-gcr
is the new tool, and-gcloud
is the deprecated one. See cloud.google.com/container-registry/docs/… -
Praxiteles almost 6 yearsOn executing statement 3 we received this warning. Any concern? "...WARNING: Unable to execute
docker version
: exit status 1 This is expected ifdocker
is not installed, or ifdockerd
cannot be reached..." -
ZaxR almost 6 yearsI don't remember encountering that, but the accepted answer makes a lot more sense than this one I think
-
Inbar Rose about 5 yearsfor me it was not in
/usr/local/Caskroom/
but in/snap/
(using ubuntu) -
asdfqwer over 3 yearsThis worked for me. For the love of god I couldn't find the executable and was about to clone and run the repo. After extracting ran:
./google-cloud-sdk/bin/gcloud init
then./google-cloud-sdk/bin/gcloud components install docker-credential-gcr
then just add the bin to your$PATH
-
Amir Chatrbahr over 3 yearsI had to make credHelpers empty
"credHelpers":{}
. thanks worked for me. -
Dirk about 3 yearsI also cleared
"credHelpers":{}
as mentioned by @amir-chatrbahr, but it was filled again. I assume it can come from updating Docker Desktop or IntelliJ (where I have an unconfigured GCloud plugin)? -
bzani about 3 yearsI was having the same problem trying to
docker-compose build
locally, after uninstalling gcloud, so after removing both files it worked fine:/usr/bin/docker-credential-gcloud
and~/.docker/config.json
-
av-k about 2 yearsHelped just to remove
~/.docker/config.json
and restart Docker.