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

ORAS CLI should support interacting with docker.io #542

Closed
FeynmanZhou opened this issue Sep 7, 2022 · 7 comments · Fixed by #549
Closed

ORAS CLI should support interacting with docker.io #542

FeynmanZhou opened this issue Sep 7, 2022 · 7 comments · Fixed by #549
Assignees
Labels
bug Something isn't working
Milestone

Comments

@FeynmanZhou
Copy link
Member

FeynmanZhou commented Sep 7, 2022

Currently, ORAS is not able to authenticate docker.io and will return 401 error:

$ oras cp mcr.microsoft.com/mmlspark/spark2.4:1.0.0 docker.io/pengfeizhou/spark2.4:1.0.0
Error: POST "https://registry-1.docker.io/v2/pengfeizhou/spark2.4/blobs/uploads/": unexpected status code 401: unauthorized: authentication required

It requires users to specify registry-1.docker.io to authenticate with DockerHub. I think ORAS should support the most common domain docker.io when interacting with DockerHub.

@FeynmanZhou FeynmanZhou added the bug Something isn't working label Sep 7, 2022
@FeynmanZhou FeynmanZhou added this to the v0.15.0 milestone Sep 7, 2022
@shizhMSFT
Copy link
Contributor

The root cause is the docker.io is a very special case. In docker CLI / daemon, the domain docker.io is mapped to registry-1.docker.io. oras-go does the same trick for docker.io.

However, when accessing the credentials, the hostname registry-1.docker.io is not recognized as docker.io.

@junczhu Could you help fixing this bug and update internal/credential/store.go to match the same behavior as docker daemon and docker CLI?

@junczhu
Copy link
Contributor

junczhu commented Sep 7, 2022

Thanks for the insight.
@shizhMSFT Please assign this issue to me and I will start working on it.

@junczhu
Copy link
Contributor

junczhu commented Sep 9, 2022

PR #549 is opened for this fix.
Kindly help check it out @FeynmanZhou

image

/cc @qweeah @shizhMSFT

@junczhu
Copy link
Contributor

junczhu commented Sep 9, 2022

For your information:

By default, command docker login and docker login docker.io will store following credential on line 3.
Command docker login registry-1.docker.io will store the credential on line 4.

image

And when using docker cli to push an image to the docker hub, with default hostname, only the credential on line 3 can be used.

When explicitly using registry-1.docker.io as hostname, like registry-1.docker.io/username/repositoryname, only the second credential can be used.

In ORAS, we have mapped 'docker.io' to 'registry-1.docker.io' for registry reference.
And I am going to apply the same operation in the ORAS CLI to help fix this issue

@junczhu
Copy link
Contributor

junczhu commented Sep 13, 2022

Hi @FeynmanZhou , the issue has been fixed.
Kindly check it out once you are available. 😊

/cc @shizhMSFT @qweeah

@FeynmanZhou
Copy link
Member Author

@junczhu Thanks for your quick response and action. I will test it from the latest main branch. Let's keep this issue open until I verify this issue.

@FeynmanZhou FeynmanZhou reopened this Sep 13, 2022
@FeynmanZhou
Copy link
Member Author

@junczhu Thanks for your quick response and action. I will test it from the latest main branch. Let's keep this issue open until I verify this issue.

@shizhMSFT @junczhu
I verified ORAS CLI from the main branch and it works with docker.io. Thanks for fixing it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants