Delete image tag from Github Container Registry

I’m using the new GHCR and generating docker images for pull requests so I can deploy to a staging environment per-PR. This works great using GitHub actions but I can’t find a way to delete the generated image tags when a PR is merged.

Based on the Docker Registry API spec it looks like I would need to fetch the manifest digest for the given tag and then delete the manifest. But trying to do this via the GHCR API gives me UNSUPPORTED.

The GHCR doc*mentation only describes the process of manually deleting an image and indicates that it may be added to the GraphQL API in the future.

Is there currently a way to delete image tags via code? If not, is this going to be part of the GA release?

EDIT: I had to censor the word “doc*mentation” because the word filter complained that my post has the word “c*m” in it. I guess someone wasn’t aware of the Sc*nthorpe problem (yeah, that triggers it too).

1 Like

I think the correct solution for the moment is to use the GitHub REST API and delete the container type package with the container name. I haven’t tried this yet, but it works for the older docker type containers (although unintuitively the API doesn’t use the repo name as apparently that’s not actually part of the package name).

The API for that was added very recently:

I’ve tried the API with a script to clean up old untagged versions, maybe you can get some inspiration from there:


That explains why I didn’t find it when I first checked. Looks like it’s still not possible to do this via the Docker ( API though. At least with the rest API I can do this alongside the other post-PR cleanup stuff.

1 Like