So, when querying images that have been pushed to a namespace within IBM Container Registry, one can format the output to only return certain columns such as repository (image) name and tag.
Who knew ?
Well, the authors of the documentation did, apparently :-)
Formatting and filtering the CLI output
For example: -
ibmcloud cr images --format "{{ .Repository }}:{{ .Tag }}"
icr.io/hello/hello_world:1.1
icr.io/hello/hello_world:1.2
icr.io/hello/hello_world:latest
etc.
Other examples, from the doc, include: -
ibmcloud cr image-list --format "{{ if gt .Size 1000000 }}{{ .Repository }}:{{ .Tag }} {{ .SecurityStatus.Status }}{{end}}"
ibmcloud cr image-digests --format '{{if not .Tags}}{{.Repository}}@{{.Digest}}{{end}}'
ibmcloud cr image-inspect ibmliberty --format "{{ .ContainerConfig.Labels }}"
etc.
Which is nice!
*UPDATE*
And, bringing two posts together, I can report the created date AND format it from Epoch time: -
ic cr images --format "{{ .Repository }}:{{ .Tag }}:{{ .Created }}" | awk 'BEGIN { FS = ":"} ; {$3 = strftime("%c", $3)} 1'
No comments:
Post a Comment