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

Credentials for Docker Hub may be stored in different registry entry. #586

Closed
coollog opened this issue Jul 12, 2018 · 10 comments
Closed

Credentials for Docker Hub may be stored in different registry entry. #586

coollog opened this issue Jul 12, 2018 · 10 comments
Assignees
Milestone

Comments

@coollog
Copy link
Contributor

coollog commented Jul 12, 2018

Some people are experiencing an authorization error when pushing to Docker Hub even if pushing with docker works. This may be because Docker Hub credentials could be stored under a different registry entry instead of registry.hub.docker.com. For example, a Docker config (located usually at $HOME/.docker/config.json) could have:

{
	"auths": {
		"https://index.docker.io/v1/": {},
...

We should support this alias as well when using Docker config to fetch credentials.

@coollog
Copy link
Contributor Author

coollog commented Jul 12, 2018

May be what's happening for #564

@coollog
Copy link
Contributor Author

coollog commented Jul 17, 2018

We should also support any auths with suffixes after the registry domain (ie. index.docker.io/v1/ vs. index.docker.io) in this method.

@chanseokoh
Copy link
Member

chanseokoh commented Jul 17, 2018

How should it work exactly? For example, my intuition is that, if the given registry is index.docker.io, it wouldn't match the entry index.docker.io/v1/ in the Docker config because it is more specific. Conversely, if the given repository is index.docker.io/v1/, it would match entries of both index.docker.io and index.docker.io/v1/. Is that right? And is the suffix only possible in the Docker config or it is generally applicable in other stores like settings.xml and the build configurations (pom.xml and build.gradle)?

@coollog
Copy link
Contributor Author

coollog commented Jul 17, 2018

So v1 or v2 refers to the Docker Registry API version that route implements. For example, GCR uses Docker Registry API V2, so all requests are to gcr.io/v2/.... In the image reference, this v1 or v2 is omitted. I think the way it should work is that the domain name should match any entry with the suffix.

ie. index.docker.io should match index.docker.io and index.docker.io/v1

I think in settings.xml, we should do the opposite: index.docker.io/v1 should match index.docker.io/v1/ and not index.docker.io. This is so that specifying credentials for gcr.io/my-gcp-project should not have those credentials be used for gcr.io/my-other-gcp-project, for example.

@chanseokoh
Copy link
Member

chanseokoh commented Jul 17, 2018

I think we should do the same to getCredentialHelperFor(), right?

@coollog
Copy link
Contributor Author

coollog commented Jul 17, 2018

Yep!

@chanseokoh
Copy link
Member

chanseokoh commented Jul 18, 2018

Hmm... I actually find a pitfall with #642 and #650, with the startsWith registry name match. For example, this.regsitry should not match this.registry.com. I think the match of startsWith(registry + "/") should do it right.

@coollog
Copy link
Contributor Author

coollog commented Jul 18, 2018

@chanseokoh hmm, good catch - we should probably match equals(registry) || startsWith(registry + "/") so that if it's just this.registry.com it will still match

@chanseokoh
Copy link
Member

What I think are the remaining tasks: also look for aliases in settings.xml and the auth section in build.gradle, and that's all?

@coollog
Copy link
Contributor Author

coollog commented Jul 19, 2018

I think we can leave that off to a later version, since the users explicitly type the names in settings.xml. (For auth, it is directly tied to the image so there is no alias necessary).

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

2 participants