[PLUG] How to get timestamp of remote files in curl command using jq

Amey sco1984 at gmail.com
Fri Aug 23 14:49:56 IST 2024


On Fri, 23 Aug 2024 at 09:59, Shantanoo <shantanoo at gmail.com> wrote:
>
> On Fri, 23-Aug-2024 at 12:07:23 IST, Amey via plug-mail wrote:
> > Hello,
> >
> > I am trying to get the timestamp of a docker image tag from a remote
> > docker repo using curl.
> > I am able to get the tag list but unable to find the command to get a
> > time stamp.
> >
> > My command = curl -X GET
> > https://docker-repo.mycompany.com/v2/product1/tags/list | jq -r
> > '.tags[]' | sort -r | head -n 3
> >
> > Output =
> >
> > 2024.6.2
> > 2024.6.1
> > 2024.4.1
> >
>
> Can you share output of https://docker-repo.mycompany.com/v2/product1/tags/list ?

testuser at vm1:~/$ curl -X GET
https://docker-repo.mycompany.com/v2/product1/tags/list
{"name":"product1","tags":["2024.6.2","2020.6.1","2024.4.1"]}

>
>
> <snip>
> ▶ curl -s -X GET "https://hub.docker.com/v2/namespaces/library/repositories/debian/tags?page_size=1" | jq '.results[] | {name, last_updated}'
> {
>   "name": "unstable-slim",
>   "last_updated": "2024-08-13T01:08:34.024358Z"
> }
> </snip>
>
>
> <snip>
> ▶ curl -s -X GET "https://hub.docker.com/v2/namespaces/library/repositories/debian/tags?page_size=10" | jq -r '.results[].last_updated'
> 2024-08-13T01:08:34.024358Z
> 2024-08-13T01:08:31.509257Z
> 2024-08-13T01:08:24.721606Z
> 2024-08-13T01:08:21.992954Z
> 2024-08-13T01:08:16.558338Z
> 2024-08-13T01:08:13.886676Z
> 2024-08-13T01:08:07.515715Z
> 2024-08-13T01:08:01.016507Z
> 2024-08-13T01:07:58.414014Z
> 2024-08-13T01:07:53.26968Z
> </snip>
>
> --
> शंतनू


More information about the plug-mail mailing list