Github Container registry (ghcr.io) packages not appearing in api

Is there any way to query the ghcr type packages using the github api (rest or graphql)?
The ghcr docs have an example of how to delete a ghcr container image version with graphql. That mutation needs the version id of the package - but how can I get that ID (or other infos about the package)?

This graphql query seems to only lists the “old” type of Docker packages (docker.pkg.github.io):

{
  viewer {
    login
    packages(first: 100) {
      edges {
        node {
          id
          name
          packageType
        }
      }
    }
  }
}

Am I looking in the wrong place? Thanks a lot for any advice!

1 Like

Having the same issue. Only old packages using docker.pkg.github.com domain are listed. Although these packages are listed in Github UI so there must be some query to fetch such information. Can you update api docs or share the correct query please ?

1 Like

anyone any idea? (even if it’s not possible yet to manage ghcr containers via the API it would be great to get a quick confirmation). Thanks!!

Hi @christian-korneck,

Sorry about the delay!

I’m afraid it isn’t possible to manage ghcr containers via the GraphQL API. The previous registry version was heavily based on GraphQL. This is a very different beast and will likely have a different API.

1 Like

Hi @jcansdale,

is there any ETA for delivery ?

1 Like

No specific ETA. I’ve confirmed that the team are working on a REST API for this.

Keep an eye on the change log:
https://github.blog/changelog/

I’ll try to report back here as well!

4 Likes

thanks @jcansdale, I think that answers my question.

same here :frowning:
that makes migration from docker.pkg.github.com to ghcr.io painful for us.

Is there a timeline for when we might see this? With the DockerApocalypse coming on Monday this is quickly becoming more and more relevant.

Just hit this today when trying to create some automation to clean up old images from GHCR
API support is essential

:wave: @benc-uk We’re actively talking about this exact use case, and a delete REST endpoint will likely be the first API we expose to our customers for Container Registry. We are hoping to expose such an endpoint before end of year.

2 Likes

Will you support the Docker Registry API for image deletion, or are you planning something GHCR specific? I think a generic solution would be preferable. Not that I’d mind an additional GHCR API for additional features, of course (especially if it offers something similar to docker image prune)! :wink:

1 Like