How to Fix `docker-credential-gcloud` not in system PATH

The “docker-credential-gcloud” error occurs when the docker-credential-gcloud is not in your system’s PATH, so the command cannot be found and executed. The docker-credential-gcloud executable is part of the Google Cloud SDK, and you need to ensure it’s correctly installed and configured on your system.

Here are the steps to fix the error.

Step 1: Check if Google Cloud SDK is installed

Run the following command to check if your system has installed the Google Cloud SDK.

gcloud --version

If it’s installed, you should see the version information. If it’s not installed or you get an error, you must install the Google Cloud SDK.

Step 2: Add docker-credential-gcloud to your system’s PATH

After installing the Google Cloud SDK, you must add the docker-credential-gcloud executable to your system’s PATH. The location of this executable depends on your operating system and how you installed the Google Cloud SDK.

For Linux and macOS, the default installation location is $HOME/google-cloud-sdk. For Windows, it might be C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk.

You can add the bin subdirectory of the Google Cloud SDK installation location to your system’s PATH by updating your shell profile file.

For Linux and macOS

export PATH="$PATH:$HOME/google-cloud-sdk/bin"

Save the file, and then run the source on the shell profile file to apply the changes.

source ~/.bashrc

Replace ~/.bashrc with the path to your shell profile file if you use a different one.

For Windows

  1. Right-click on “This PC” or “Computer” and select “Properties.”
  2. Click on “Advanced system settings” on the left side.
  3. Click on the “Environment Variables” button.
  4. Under “System variables”, find and select the “Path” variable, then click “Edit.”
  5. Click “New” and add the Google Cloud SDK bin folder path (e.g., C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin).
  6. Click “OK” to save the changes and close all windows.

After updating the PATH, restart your terminal or command prompt for the changes to take effect. You should now be able to use docker-credential-gcloud without any issues.

That’s it.

Leave a Comment