OC command to view the tag information
Asked Answered
B

1

9

I would like to know the tag applied to all the images in a namespace. Is there any oc command to view tags in a namespace?

Before posting this question, i googled. However i didn't find any. So I am posting this question here.

Bevatron answered 4/4, 2018 at 10:56 Comment(5)
You can view details of all image streams in a project by running oc describe is. This will list tags for each image stream along with lots of other information. Add an extra argument of a specific image stream to be selective.Arian
@Graham Dumpleton, Thank you for prompt response. let me put my requirement, "retrieve all images with <b>"release" tag <\b> in a namespace." I see <i>oc get is -n <namespace> </i> providing information. But i was wondering is there any easy way to get like application name and all the tag names of that application. For Example: apache application has 8 tags. Then expected response would be apache 1.2, 1.4, 1.8, 2.0 release, baseline, build , prod.Bevatron
Try playing with this oc get is python -n openshift --template='{{.metadata.name}}{{range .spec.tags}}{{" "}}{{.name}}{{end}}{{"\n"}}'. This will output python 2.7 3.3 3.4 3.5 3.6 latest.Arian
@GrahamDumpleton super helpful! thank you! question - if I wanted to add the image created date / age at the end do you know the construct? I tried {{.created}} with no luck :(Koah
You may want to look at imagestreamtag objects instead if need more detail that not in the imagestream object. Use oc get imagestreamtag imagename:tagname -o json and see if details are in there.Arian
R
7

You may get details from imagestreamtag object. If you need formatted tags only as a list you can execute this command.

oc get imagestreams imagename -o jsonpath='{range .status.tags[*]}{.tag}{"\n"}'

This will return something like this as result as formatted:

20.10.321
20.13.328
20.14.333
20.14.338
20.16.342
Reticulation answered 19/1, 2021 at 19:40 Comment(1)
This is pretty nice for displaying the tags for a specific imagename, but is there a way to do this for all the images in the namespace? That is, all the images in a project? I tried the command omitting the imagename, but there was no output. I know there are tags for the images in my project (at least latest) because I see them if I use the command oc get imagestreams.Sestet

© 2022 - 2024 — McMap. All rights reserved.