Skip to content
New issue

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

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

Already on GitHub? # to your account

Bug: auth.StaticCredential does not properly handle docker.io #484

Closed
Wwwsylvia opened this issue Apr 17, 2023 · 3 comments · Fixed by #504
Closed

Bug: auth.StaticCredential does not properly handle docker.io #484

Wwwsylvia opened this issue Apr 17, 2023 · 3 comments · Fixed by #504
Labels
bug Something isn't working

Comments

@Wwwsylvia
Copy link
Member

When remote.Registry is accessing docker.io, it actually issues requests to registry-1.docker.io. Therefore, it expects the client.Credential to return the credential for registry-1.docker.io instead of docker.io.
But the current implementation of auth.StaticCredential does not handle this case.

@Wwwsylvia Wwwsylvia added the bug Something isn't working label Apr 17, 2023
@Wwwsylvia
Copy link
Member Author

One of the workarounds before this bug gets fixed is that, passing repo.Reference.Host() instead of registry name to StaticCredential().

   repo, _ := remote.NewRepository("docker.io/library/hello-world")
   repo.Client := &auth.Client{
               // other fields...
   	Credential: auth.StaticCredential(repo.Reference.Host(), cred),
   }

@Wwwsylvia Wwwsylvia changed the title Bug: auth.Credential does not properly handle docker.io Bug: auth.StaticCredential does not properly handle docker.io Apr 18, 2023
@qweeah
Copy link
Contributor

qweeah commented Apr 28, 2023

Sorry I don't get the workaround. Suppose the registry name is docker.io, shouldn't repo.Reference.Host() also be docker.io?

@Wwwsylvia
Copy link
Member Author

Wwwsylvia commented Apr 28, 2023

repo.Reference.Host() maps docker.io to registry-1.docker.io internally.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants