10

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?

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
jactor-rises
  • 2,395
  • 2
  • 22
  • 44
  • 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")` – jactor-rises Aug 13 '21 at 13:50

1 Answers1

8

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
Kenny
  • 125
  • 6