Skip to content

How to check if a container image exists on GHCR? #26279

Discussion options

You must be logged in to vote

You can use the tags/list endpoint to grab all available tags.

You’ll need a token for this like a PAT. (soon this will work with the GITHUB_TOKEN)

Here’s an example:

# for a public image you can get a fake NOOP token to use
curl https://ghcr.io/token\?scope\="repository:USER/IMAGE:pull"
{"token":"{TOKEN}"}
curl -H "Authorization: Bearer {TOKEN}" https://ghcr.io/v2/USER/IMAGE/tags/list
{"name":"USER/IMAGE","tags":["2.7.5-arm64","2.7.5-armhf","2.7.5-amd64"]}

Replies: 5 suggested answers 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@KES777
Comment options

@airtower-luna
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions and Packages Host dependencies and test and deploy your code with world-class CI/CD and package hosting
6 participants