Get the last uploaded docker image from gitlab container registry

2.6k Views Asked by At

We store docker images in gitlab container registry. The images have tags such as imagename-datetimestamp.So if an image A is built at 8 a.m on 5/21/21, it is uploaded as imagenameA-0521210800. The next one built at 12 p.m is uploaded as imagenameA-0521211200. Is there an api or command that can help me fetch the last uploaded image at any time? In this case "imagenameA-0521211200" is the last uploaded.

Note: I do not want to pull with "latest" tag.

Thanks

1

There are 1 best solutions below

0
On

I suggest you to use the API to get your images tags list as per the example at https://docs.docker.com/registry/spec/api/#tags .

Then parse the result (eg. by jq), sort results and invokedocker pull for the right tag.