`docker-credential-gcloud` not in system PATH

后端 未结 10 1372
悲哀的现实
悲哀的现实 2020-12-14 14:38

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

相关标签:
10条回答
  • 2020-12-14 15:03

    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.

    0 讨论(0)
  • 2020-12-14 15:06

    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
    ...
    
    0 讨论(0)
  • 2020-12-14 15:07

    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

    Finish!

    0 讨论(0)
  • 2020-12-14 15:09

    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.

    0 讨论(0)
  • 2020-12-14 15:11

    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

    0 讨论(0)
  • 2020-12-14 15:11

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

    0 讨论(0)
提交回复
热议问题