Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get gcloud.auth.docker-helper out of the habit to hook into non-related docker build?

Tags:

docker

gcloud

Sure i have gcloud CLI installed. But since when i call docker build unrelated to any gcloud actions the log prologs with

$ docker build -t ...
ERROR: (gcloud.auth.docker-helper) You do not currently have an active account selected.
Please run:

  $ gcloud auth login

to obtain new credentials, or if you have already logged in with a
different account:

  $ gcloud config set account ACCOUNT

to select an already authenticated account to use.
Sending build context to Docker daemon  5.346MB
Step 1/8 : FROM node:alpine
...

How do i disable gcloud.auth.docker-helper, b/c unrelated, while keeping gcloud installed?

P.S. Bonus if somebody has pointers/background what this underlying mechanism is and where this behaviour documented on sides of docker and/or gcloud are

like image 651
Joerg M. Avatar asked Dec 03 '19 00:12

Joerg M.


People also ask

What is Gcloud Auth configure Docker?

The gcloud credential helper provides secure, short-lived access to your project resources. It configures Docker to authenticate to Artifact Registry hosts in any environment where the Google Cloud CLI is installed. Cloud Shell includes the Google Cloud CLI and a current version of Docker.


1 Answers

This appears to be part of docker login configuration. Specifically the credential helpers specified in the .docker/config.json

You can check it by running: cat [User_Home_Directory]/.docker/config.json Example:

{
        "auths": {},
        "credHelpers": {
                "asia.gcr.io": "gcr",
                "eu.gcr.io": "gcr",
                "gcr.io": "gcr",
                "marketplace.gcr.io": "gcloud",
                "staging-k8s.gcr.io": "gcr",
                "us.gcr.io": "gcr"
        }
}

If you do not want to use anything that requires docker to authenticate with gcloud or gcr (e.g Container Registry), then you can remove the credential helpers from the .docker/config.json so it looks like this:

{
        "auths": {},
        "credHelpers": {
        }
}

For the Docker documentation you can check:

  • docker login
  • config.json properties

You can also take a look at Container Registry Authentication methods which explains how docker authenticates with gcloud.

like image 70
Waelmas Avatar answered Nov 16 '22 03:11

Waelmas