Unable to list docker images using the Docker v2 API

I am unable to list all the tags for my Docker image as per the Docker V2 spec. I am using Personal access token with my username to authenticate.

Here is the same curl request -

curl --location --request GET 'https://ghcr.io/v2/deepakputhraya/mailcheck/mailcheck/tags/list' \
--header 'Authorization: Basic ...=='

{"errors":[{"code":"DENIED","message":"invalid token"}]}

I tried the same with docker.pkg.github.com and it worked.

curl --location --request GET 'https://docker.pkg.github.com/v2/deepakputhraya/mailcheck/mailcheck/tags/list' \
--header 'Authorization: Basic == ...' \

The above return 200 with all the tags.

The ghcr.io endpoint used to work but not anymore. Has something changed? Is the expected behaviour?


Yes, I confirm that this used to work.

For the legacy Docker Registry Artifacts, I managed to workaround.
But I’m stuck with a few GHCR Native ones here.

I wonder if there’s a new mechanism where we must use the PAT to generate another token, or anything similar.

I couldn’t find anything yet, btw!

1 Like

I ran into this issue today when I changed from the old registry to the ghcr

The V2 api should be supported, but I can’t find any documentation how the auth differs

This worked with the old registry, but ghcr returns 403.

curl \
  --fail \
  -u "${token:?}":"${token:?}" \

Yeah, you need to exchange the PAT for a ghcr token. Something like this:

GET https://ghcr.io/token?service=ghcr.io&scope=repository::pull&client_id=something

1 Like

Here’s the Docker documentation on the topic:

That process worked for me with a PAT in basic auth. :slightly_smiling_face: