Do we have an API to programmatically get the value of image tags for the below image?
https://access.redhat.com/containers/?tab=tags&get-method=registry-tokens#/registry.access.redhat.com/rhel7
Use case: Grab the later version if a new tag version is available.
I'm looking for something like below:
wget -q https://registry.hub.docker.com/v1/repositories/debian/tags -O - | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n' | awk -F: '{print $3}'
The above solution is from the stackoverflow question:
https://stackoverflow.com/questions/28320134/how-can-i-list-all-tags-for-a-docker-image-on-a-remote-registry
I did
wget https://access.redhat.com/containers/?tab=tags&get-method=registry-tokens#/registry.access.redhat.com/rhel7
Unfortunately, it gives a lot of redundant data which does not help.
I appreciate any lead.
Thank you
One option is to use the skopeo
command to get information about the remote image. For example, if you run:
skopeo inspect docker://registry.access.redhat.com/rhel7
You'll get back a chunk of JSON data that includes information about all of the available tags:
{
"Name": "registry.access.redhat.com/rhel7",
"Digest": "sha256:11ec91dcb3505f6eaa02d815fab39078786f3ddbef26796e3ef348410ca43b9d",
"RepoTags": [
"7.3-74",
"7.4-120",
"7.2-56",
"7.3-89",
"7.3-66",
"7.5-424",
"7.5-245.1527091554",
"7.4-129",
"7.1-12",
"7.6-122",
"7.3-82",
"7.7-384.1575996163",
"7.5-409.1533127727",
"7.2-75",
"7.2-38",
"7.6",
[...]
(There are about 70 total.)
Since skopeo
returns JSON results, it's easy to take this output and programatically parse it to extract the information you want.
Using the debug output from skopeo
(skopeo --debug ...
), I see that the list of tags is also available from https://registry.access.redhat.com/v2/rhel7/tags/list
. That appears to work without authentication, so maybe that is the simplest option.