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
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.
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:
You can also take a look at Container Registry Authentication methods which explains how docker authenticates with gcloud.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With