Deleting images from Github Package Registry #21609
-
As part of my CI Actions workflow, I push a docker image of the latest branch commit to GPR and pull it onto a remote docker-machine for testing. The image is tagged with the commit sha like so to prevent concurrent workflows from mixing:
After my tests are complete, I would like to delete/remove the image from Github Package Registry but I can’t seem to find the functionality after reviewing the docker x gpr documentation here: https://help.github.com/en/github/managing-packages-with-github-packages/configuring-docker-for-use-with-github-packages or package management documentation here: https://help.github.com/en/github/managing-packages-with-github-packages/deleting-a-package. Is there a way to delete/remove docker images from GPR? If so can someone point me in the right direction or does this functionality not exist yet? |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments
-
Hi @kachow6, Thank you for being here! This functionality is currently in the works, for now you might message us via https://github.com/contact with the info, for our support folks to take care of it. |
Beta Was this translation helpful? Give feedback.
-
Hi thanks for the response @andreagriffiths11, Where can I find the update/release log for Github Package Registry? I would like to be notified when this feature is released. |
Beta Was this translation helpful? Give feedback.
-
Hi @andreagriffiths11 ! Any update on this topic yet? Best regards, Max |
Beta Was this translation helpful? Give feedback.
-
Just wanted to chime in here. I want to use the image registry for my team since it will speed up our development efforts having the builds so close to the source, but not being able to manage the images with full CRUD really diminishes our desire to use it. Without this abililty I’m going to have to make a choice soon to use a service like ECR to manage our images. This doesn’t make much sense since we’re already paying for an enterprise account. Once we make a choice to use an external service across all of our applications, migrating back to GHR won’t make much sense because of the manhours it would take to migrate everything back to yet another image registry. I’m not asking for an explanation as to why it’s not here, but I can’t wait forever for this functionality and I assume there are a couple thousand other teams that are in the same situation. That seems like a fairly heavy loss of untapped revenue, enough that perhaps this could have a priority escalation or at the very least far more communcation about the status of the improvement. Thanks, Jake |
Beta Was this translation helpful? Give feedback.
-
We also have the same issues. We would like to delete images and we’d be glad if that was supported soon. |
Beta Was this translation helpful? Give feedback.
-
https://help.github.com/en/packages/publishing-and-managing-packages/deleting-a-package |
Beta Was this translation helpful? Give feedback.
-
Since initially making this post I was able to come up with a solution using curl, jq, and the github graphql api that worked for my specific use case (deleting a gpr image based on the version name within an actions workflow). Sharing it here in hopes that it helps someone else. Note, I had to create a github personal access token with read, write, and delete privileges for GPR packages, which i stored as a repository secret. Get the 10 most recent package versions and save the version id with name that matches the current commit sha:
Attempt to delete the version based on $VERSION_ID:
Check result of deletion step and fail workflow if deletion failed (otherwise passes regardless):
|
Beta Was this translation helpful? Give feedback.
-
Thanks so much for this. I tag my Docker images with the branch name - for anyone doing something similiar, I was able to modify the first query to get the version ID like this:
|
Beta Was this translation helpful? Give feedback.
-
If you’re looking for a simpler delete solution we maintain an action that helps you automate this process https://github.com/actions/delete-package-versions |
Beta Was this translation helpful? Give feedback.
-
Updating this to be the recommended solution thanks |
Beta Was this translation helpful? Give feedback.
-
Updated script to get first 10 packages after registryPackages was deprecated on 2020-04-01:
|
Beta Was this translation helpful? Give feedback.
-
if you need delete images by tag you can checkout our action github.combots-house/ghcr-delete-image-action♻️ Delete GitHub Container Registry image by tag. Contribute to bots-house/ghcr-delete-image-action development by creating an account on GitHub. |
Beta Was this translation helpful? Give feedback.
If you’re looking for a simpler delete solution we maintain an action that helps you automate this process https://github.com/actions/delete-package-versions