User login api for ghcr

HI,

For docker hub registry there is any user login api which is https://hub.docker.com/v2/users/login when it the equvilient for ghcr.io ? we need it for our API’s…

Thanks

Hey, Jenny!

You find it in the docs.

@JennyMet

GHCR implements the registry specification as defined by Docker which is meant to serve the Docker Engine.

That being said, you can still get a token by making a GET request to /token like:

✦ ➜ curl -v -u {GH username}:{GH PAT} https://ghcr.io/token\?scope=repository:{namespace}/{image}:pull

This will return a token in the response if you have access to the requested image:

{"token":"{TOKEN}"}

This follows the specification described by docker here

We don’t currently support the _catalog endpoint which would allow you to list all repositories that you have access to, although this is planned in the future

2 Likes