Labels for the Derived Image
FlexNet Manager Suite ()
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 app.flexera.com
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 --filter=label=app.flexera.com=imgtrack
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
andndtrack
- Link the image to the
.ndi
inventory file that was (or would have been) generated byndtrack
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}}'
app.flexera.com: imgtrack
imgtrack.flexera.com/filename: imgtrack-sha256_6647385dd9ae.ndi
imgtrack.flexera.com/id:
sha256:6647385dd9ae11aa2216bf55c54d126b0a85637b3cf4039ef24e3234113588e3
imgtrack.flexera.com/managesoft_version: 17.3.0
imgtrack.flexera.com/version: 1.0.0
source.imgtrack.flexera.com/image_id:
sha256:b2fcd079c1d403dc1dba5397ca1bca606f17ebcf99b03b66c59941929acff57c
source.imgtrack.flexera.com/repo_digest:
postgres@sha256:6647385dd9ae11aa2216bf55c54d126b0a85637b3cf4039ef24e3234113588e3
source.imgtrack.flexera.com/tag: 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
{
"app.flexera.com": "imgtrack",
"imgtrack.flexera.com/filename": "imgtrack-sha256_6647385dd9ae.ndi",
"imgtrack.flexera.com/id":
"sha256:6647385dd9ae11aa2216bf55c54d126b0a85637b3cf4039ef24e3234113588e3",
"imgtrack.flexera.com/managesoft_version": "17.3.0",
"imgtrack.flexera.com/version": "1.0.0",
"source.imgtrack.flexera.com/image_id":
"sha256:b2fcd079c1d403dc1dba5397ca1bca606f17ebcf99b03b66c59941929acff57c",
"source.imgtrack.flexera.com/repo_digest":
"postgres@sha256:6647385dd9ae11aa2216bf55c54d126b0a85637b3cf4039ef24e3234113588e3",
"source.imgtrack.flexera.com/tag": "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 --filter=label=app.flexera.com=imgtrack --format={{.ID}}); do
echo "$image"
docker inspect $image
--format='{{range $k, $v := .Config.Labels}}{{printf "\t%s: %s\n" $k $v}}{{end}}'
done
Parent topic:How imgtrack Works