Labels for the Derived Image

FlexNet Manager Suite 2022 R1 (On-Premises)

The derived images created by imgtrack are not tagged with a name. If you have used one of the options that prevent cleanup of the derived image(s), you may want to manage the images or eventually delete them. To facilitate this, the derived images are labelled with a variety of information.

Firstly, all the derived images have a label with the value imgtrack. The --filter option to the docker image ls command can be used to list all images tagged with this label:
docker image ls
In the output from this command, the REPOSITORY and TAG field have the value <none>, and cannot be used for image management. The IMAGE ID field, however, has the short-form ID (the first 12 characters of the ID) of the image, which can be used in subsequent docker commands to interact with the image.
Other labels:
  • Describe the source image
  • Identify the versions used of imgtrack and ndtrack
  • Link the image to the .ndi inventory file that was (or would have been) generated by ndtrack for the image.
You can extract the labels from the image metadata in any of the following ways:
  • Run the docker inspect command, and visually identify the labels in the JSON data the command produces.
  • Use Docker's templating feature to extract and format the labels (lines wrapped for presentation here):
    shell$ docker inspect b069f4a6dd3b 
        --format='{{range $k, $v := .Config.Labels}}{{printf "%s: %s\n" $k $v}}{{end}}' imgtrack imgtrack-sha256_6647385dd9ae.ndi 
        sha256:6647385dd9ae11aa2216bf55c54d126b0a85637b3cf4039ef24e3234113588e3 17.3.0 1.0.0 
        postgres@sha256:6647385dd9ae11aa2216bf55c54d126b0a85637b3cf4039ef24e3234113588e3 postgres:13
  • Use the jq tool to extract the labels from the JSON data (lines wrapped for presentation):
    shell$ docker inspect b069f4a6dd3b | jq .[0].Config.Labels
      "": "imgtrack",
      "": "imgtrack-sha256_6647385dd9ae.ndi",
      "": "17.3.0",
      "": "1.0.0",
      "": "postgres:13"
As an exercise, the following shell script snippet illustrates how you could find and display the labels for every derived image built by imgtrack on the Linux device:
for image in $(docker image ls --format={{.ID}}); do
  echo "$image"
  docker inspect $image 
      --format='{{range $k, $v := .Config.Labels}}{{printf "\t%s: %s\n" $k $v}}{{end}}'

FlexNet Manager Suite (On-Premises)

2022 R1