Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requires authentication even for public registries #666

Closed
samos123 opened this issue Jan 30, 2020 · 6 comments
Closed

Requires authentication even for public registries #666

samos123 opened this issue Jan 30, 2020 · 6 comments

Comments

@samos123
Copy link

samos123 commented Jan 30, 2020

Currently when using a public image from GCR it will fail with trying to authenticate with Google Cloud. However for public images that shouldn't be needed.

Steps to reproduce:

  1. Remove any authentication with gcloud. E.g. mv ~/.config/gcloud{,.bak}
  2. Use go-containerregistry to pull an image from a public GCR repo
crane pull gcr.io/distroless/base-debian10 test.tgz
WARNING: Could not open the configuration file: [/home/stoelinga/.config/gcloud/configurations/config_default].
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.
2020/01/29 16:40:05 error getting credentials - err: exit status 1, out: ``

Current result:
Failure telling you to authenticate with google cloud

Expected result:
Successfully pull down the image

@jonjohnsonjr
Copy link
Collaborator

Seems like you've configured a credential helper in ~/.docker/config.json (or $DOCKER_CONFIG) but it isn't set up properly.

We do eagerly get credentials for a registry, which is the cause of this error. If we deferred fetching creds until we actually got a 401, we could avoid this... which is definitely something we should do.

@tejal29
Copy link

tejal29 commented Jan 30, 2020

@samos123, i ended up removing ~/.docker/config.json and ~/.config/gcloud. Looks like i was able to pull the image.

$mv ~/.config/gcloud ~/Desktop

$ls ~/.config/
configstore	gbackup		hub
$ls ~/.config/gbackup/
exclude		exclude.d	include

 $crane pull gcr.io/distroless/base-debian10 test.tgz
2020/01/29 16:59:55 No matching credentials were found, falling back on anonymous

$ls -alh test.tgz 
-rw-r--r--  1 tejaldesai  primarygroup   8.3M Jan 29 17:02 test.tgz

@samos123
Copy link
Author

samos123 commented Jan 30, 2020

interesting then it must be something in Kaniko that we're doing incorrectly in relation to this library. Since on Travis CI, i did not configure the gcloud docker credential helper but it would still fail with a similar message that authentication with gcloud was needed.

@tejal29
Copy link

tejal29 commented Mar 11, 2020

Thanks a lot @filesnate for debugging this.
I agree, we should replace config.json with empty file and other users who use private images can add their config as a volume mount inside cluster like this
or on the docker run command like you mentioned

Would you up for submitting a PR to remove credentials helper in from the executor image ?

@filesnate
Copy link

@github-actions
Copy link

This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants