Skip to content

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

Answered by clarkbw
ten-chh asked this question in Actions
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: 8 comments 9 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
4 replies
@tsnobip
Comment options

@austinworks
Comment options

@victorlin
Comment options

@NiceGuyIT
Comment options

Comment options

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

@airtower-luna
Comment options

Comment options

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

@relsqui
Comment options

Comment options

You must be logged in to vote
1 reply
@airtower-luna
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Product Feedback