kleveross / ormb

Docker for Your ML/DL Models Based on OCI Artifacts
Apache License 2.0
461 stars 61 forks source link

ORMB login should work with docker token #188

Closed mishraprafful closed 3 years ago

mishraprafful commented 3 years ago

Is this a BUG REPORT or FEATURE REQUEST?: FEATURE REQUEST

Uncomment only one, leave it on its own line: /kind feature

What happened: Not able to login using docker token or docker base config.

What you expected to happen: Should be able to login using docker token or docker base config.

How to reproduce it (as minimally and precisely as possible): None

Anything else we need to know?: Login using password and usernme is available but there is a need to be able to login using the docker login token or .docker/.base_dockerconfig

gaocegege commented 3 years ago

SGTM, it should work. But I am not sure if it is safe to read the docker auth config.

mishraprafful commented 3 years ago

I might be short-sighted here, but could you point me to why do you think it might not be safe.

The use-case is that I have containers that are authenticated to push and pull to my docker registry using docker tokens and config. I wish to authenticate for ORMB as well using the same, rather than having to use a USERNAME and PASSWORD using a robot account. Let me know your thoughts.

gaocegege commented 3 years ago

Docker config may have more than one user/pwd. If you are an administrator and you logged in many registries locally, I am not sure if you want to share the information with ormb client. But we can add a command or argument to support such case. I think.

Maybe a command ormb auth-from-docker or something else.

mishraprafful commented 3 years ago

Thanks, I understand the concern now. Do you think it is possible for me to contribute to this, but I would need some help to understand a few things.

gaocegege commented 3 years ago

Thanks!

Your contribution is welcome! :tada: :+1:

gaocegege commented 3 years ago

As you know, we are using path.Join(client.rootPath, "config.json") https://github.com/kleveross/ormb/blob/c3a53c071c311f008217ee10ddb9af5a623ccba6/pkg/oras/client.go#L58 to store the credentials. The file config.json is similar to docker config.json. What we should do is to copy the credentials from docker config.json to ormb config.json. Maybe we can just get all credentials and call ormbclient.Login for every one. This func call writes the info to the config.json.

mishraprafful commented 3 years ago

Thanks for pointing it out, I think I can start from here soon. Will ping back if I have any more questions 🙂

gaocegege commented 3 years ago

Sure, thanks.