How to populate the Version field in flyctl image show

When I run flyctl image show it shows me 5 fields: Registry, Repository, Tag, Version and Digest. e.g:

$ flyctl image show
Deployment Status
  Registry   = registry.hub.docker.com                                                  
  Repository = shieldsio/shields                                                        
  Tag        = next                                                                     
  Version    = N/A                                                                      
  Digest     = sha256:f9b96cd263cbb762aec7f43738591d6c820c19c713035e6ec7817854a1c64c9d

How is the Version field populated?

I took a guess based on

that this could be populated by setting LABEL fly.version in my Dockerfile

so I tried that

but no dice.

How can I populate the Version field?

Thanks.

1 Like

Hi!
I just need a little more information here, what are you needing this version field to show and why? What is the end goal here?

Sure. When I build my docker image, I pass a build arg which contains a version string. In the case of the next docker tag, its based on the git commit hash we’re building the image from:

Ideally I’d like to be able to surface this value when I run flyctl image show. The high level objective is I’d like to be able to easily answer the question “which git commit in my repo does the docker image currently deployed on fly.io correspond to?” - if there’s another approach we could use, then I’m happy to hear it. Thanks

Ah, okay, unfortunately that version tracking is only available for images Fly creates at the moment (Postgres and Livebook) and isn’t available for custom images.

1 Like

OK. Thanks for the response. That’s a shame. I’ll have a think about other options.

FWIW I think the ability to either:

  • surface docker image metadata from deployed images or
  • annotate deploy events with some metadata

would be a really useful feature for fly.io .

This is coming! It’ll be a while, but most of what we use for Postgres will be available for other apps in a few months.

2 Likes