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
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.
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
...
Install gcloud and docker-credential-gcr, following this tutorial
$ ln -s /usr/local/google-cloud-sdk/bin/docker-credential-gcr /usr/local/bin/docker-credential-gcloud
$ rm -rf ~/.docker
$ docker-compose build --pull
Finish!
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.
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
In my case the problem was due to how WSL 1 works with Docker on Windows. At first I only installed and initialized gcloud
in WSL Ubuntu, not in Windows. However as Docker daemon is actually run by Windows, you need to install gcloud
for Windows as well (and don't forget to run all of the inits and authorizations there).