-
Select Topic AreaQuestion BodyI'm looking for a timestamp for each Docker tag from ghcr.ioThe Docker Hub API gives me back rich metadata for each tag including $ curl https://hub.docker.com/v2/repositories/library/monica/tags/ | jq .
{
"count": 161,
"next": "https://hub.docker.com/v2/repositories/library/monica/tags/?page=2&page_size=10",
"previous": null,
"results": [
{
"creator": 1156886,
"id": 114871391,
"images": [
{
"architecture": "amd64",
"features": "",
"variant": null,
"digest": "sha256:d8372b75ebdf58e11e2d0740ebea519a1ab05713f1f3969b302afb855614e48c",
"os": "linux",
"os_features": "",
"os_version": null,
"size": 212496192,
"status": "active",
"last_pulled": "2024-05-17T19:00:04.301911Z",
"last_pushed": "2024-05-14T19:40:32.043167Z"
},
# ... snip
]
--> "last_updated": "2024-05-14T19:42:08.294229Z", <--
"last_updater": 1156886,
"last_updater_username": "doijanky",
"name": "latest",
"repository": 9711628,
"full_size": 212496192,
"v2": true,
"tag_status": "active",
"tag_last_pulled": "2024-05-17T20:00:08.897881Z",
"tag_last_pushed": "2024-05-14T19:42:08.294229Z",
"media_type": "application/vnd.docker.distribution.manifest.list.v2+json",
"content_type": "image",
"digest": "sha256:166ecd36f5600a2abbcccc0dce94670fb1827e6f7096b79d30a3f7ab3557989d"
},
# ... snip This API response can be used to say the However, it doesn't work for GHCR.io: $ curl -v https://ghcr.io/v2/repositories/gethomepage/homepage/tags/
< HTTP/2 404
< content-type: text/plain; charset=utf-8
< x-content-type-options: nosniff
< date: Fri, 17 May 2024 20:06:08 GMT
< content-length: 19
<
404 page not found What I've TriedI can fetch all tags by paginating $ export GITHUB_TOKEN=...
$ export repo=gethomepage/homepage
$ export token=$(curl -H "Authorization: Bearer $GITHUB_TOKEN" -s "https://ghcr.io/token?service=ghcr.io&scope=repository:${repo}:pull" | jq -r .token)
$ curl -i -H "Authorization: Bearer $token" https://ghcr.io/v2/${repo}/tags/list?n=100
HTTP/2 200
content-type: application/json
docker-distribution-api-version: registry/2.0
link: </v2/gethomepage/homepage/tags/list?last=nightly&n=5>; rel="next"
content-length: 85
{"name":"gethomepage/homepage","tags":["main","v0.7.2","latest","v0.7.3","nightly"]} This seems to be a rough implementation of the OCI image manifest API, specifically I know GitHub has this info since it shows up in the UI: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
It looks like you can paginate the versions with more metadata here: https://docs.github.com/en/rest/packages/packages?apiVersion=2022-11-28#list-package-versions-for-a-package-owned-by-an-organization $ curl -L -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-v \
'https://api.github.com/orgs/gethomepage/packages/container/homepage/versions?state=active&per_page=100' | jq .
< HTTP/2 200
< server: GitHub.com
< date: Fri, 17 May 2024 20:18:55 GMT
< content-type: application/json; charset=utf-8
< x-github-media-type: github.v3; format=json
< link: <https://api.github.com/organizations/122929872/packages/container/homepage/versions?state=active&per_page=100&page=2>; rel="next", <https://api.github.com/organizations/122929872/packages/container/homepage/versions?state=active&per_page=100&page=46>; rel="last"
< x-github-api-version-selected: 2022-11-28
[
# ... snip
{
"id": 212381245,
"name": "sha256:43a3ee88abe3b37c64bc52ea93da01c3dcb4a332a953bcd7f438c8d7328d3947",
"url": "https://api.github.com/orgs/gethomepage/packages/container/homepage/versions/212381245",
"package_html_url": "https://github.com/orgs/gethomepage/packages/container/package/homepage",
"created_at": "2024-05-06T05:20:30Z",
"updated_at": "2024-05-06T05:20:30Z",
"html_url": "https://github.com/orgs/gethomepage/packages/container/homepage/212381245",
"metadata": {
"package_type": "container",
"container": {
"tags": [
"v0.8.13",
"latest"
]
}
}
}
] |
Beta Was this translation helpful? Give feedback.
-
Hey @parkr! Nice one! That's exactly the resource I would have suggested! |
Beta Was this translation helpful? Give feedback.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
It looks like you can paginate the versions with more metadata here: https://docs.github.com/en/rest/packages/packages?apiVersion=2022-11-28#list-package-versions-for-a-package-owned-by-an-organization