How to see (not download) docker image from ghcr.io
Asked Answered
P

1

11

I am publishing docker images to GitHub container registry (ghcr.io).

The process of doing that:

  1. Build component.
  2. Build docker image which include component.
  3. Upload docker image to ghcr.io.
  4. Deploy docker image.
  5. Run integration tests on docker image.

Sometimes step 4 or 5 return an error which is not resolvable from within the Docker image, and after the issue is fixed, I need to redeploy and retest the artifact.

If this happens, the process of building the component, including junit tests, is a pain because the Docker image is already built and present on ghcr.io.

Is there a way I can see if a tagged Docker image is present in ghcr.io?

Peart answered 13/8, 2021 at 10:45 Comment(1)
previously I used docker.pgk.github.com and solved this by getting the manifest of the docker image using curl: URL="https://docker.pkg.github.com/v2/$GITHUB_REPOSITORY/$IMAGE_NAME/manifests/$GITHUB_SHA" REQUEST=$(curl --head --request GET "$URL" -u "$GITHUB_ACTOR:$GITHUB_TOKEN")Peart
S
10

The GHCR API is still in early development. Until it is fleshed out a bit more, you may have to resort to using skopeo to get what you need.

docker run --rm quay.io/skopeo/stable list-tags docker://ghcr.io/$GITHUB_REPOSITORY/$IMAGE_NAME
Script answered 5/9, 2021 at 20:46 Comment(1)
Thanks @Script this worked for me and this info was hard to come by.Snooze

© 2022 - 2024 — McMap. All rights reserved.