question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test image with multiple tags from metadata-action

See original GitHub issue

There’s an example on how to load and test an image with a fixed tag: https://github.com/docker/build-push-action/blob/master/docs/advanced/test-before-push.md. But I’m using metadata-action to potentially build and push images with multiple tags, thus just trying to run ${{ steps.meta.outputs.tags }} won’t work.

Previously I didn’t use gha cache and then ${{ steps.build.outputs.digest }} seemed to work for docker run. But since adding caching (and thus docker/setup-buildx-action), this doesn’t work anymore:

 docker: Error response from daemon: No such image: sha256:6507963a29515198ef9813243ad16cd47e864a05594682b66e0de32fbc9196e2.

I guess it’s somehow related to #461, but I don’t really care what digest is what and where it’s shown. I just want to run the loaded image.

I also tried ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}, but that doesn’t work for running the locally loaded image either:

Unable to find image 'ghcr.io/goblint/analyzer@sha256:53a5a659327deceb4ea5f1a9e89d6648cd8069d2b5bc59d7b75d1199987fd768' locally

How is this supposed to be done?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
sim642commented, Nov 21, 2021

Thanks! This is what I was looking for. Maybe it would be useful for others to have this mentioned in the test-before-push example document as well.

2reactions
crazy-maxcommented, Nov 21, 2021

@sim642 Don’t really get your point of using the metadata action in the step that exports the image to docker to be able to test it but you can use the ${{ steps.meta.outputs.version }} output:

      -
        name: Test
        run: |
          docker run --rm name/app:${{ steps.meta.outputs.version }}

Or the JSON output from the metadata action:

      -
        name: Test
        run: |
          docker run --rm ${{ fromJSON(steps.meta.outputs.json).tags[0] }}

Or the metadata output of this action:

      -
        name: Test
        run: |
          docker run --rm ${{ fromJSON(steps.build.outputs.metadata)['containerimage.config.digest'] }}
Read more comments on GitHub >

github_iconTop Results From Across the Web

GitHub - docker/metadata-action
GitHub Action to extract metadata (tags, labels) from Git reference and GitHub events for Docker - GitHub - docker/metadata-action: GitHub ...
Read more >
Add a tag to a Docker image if there's a git tag using GitHub ...
It would be easy to always add more tags, but I want to add it only if there's a git tag. Is there...
Read more >
How to make sortable image tags to use with automation | Flux
This guide explains how to construct image tags so that the most recent image has the tag that comes last in alphabetical or...
Read more >
Example workflows - Docker Documentation
The following workflow will use the Docker Metadata Action to handle tags and ... Build and export the image to Docker; Test your...
Read more >
The Best Ways to Organize Your Files with Tags and Labels
How to organize your files, photos, emails, and more with a tagging system. ... exporting images, the app saves their tags as keywords...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found