获取最佳Docker Hub映像的API?

我想知道是否有API来获得顶级Docker Hub映像?

就像我们打开https://hub.docker.com/explore/时所能获得的一样

我检查过:

https://docs.docker.com/engine/api/v1.28/#和https://docs.docker.com/registry/spec/api/

但没有find我想要的。

https://hub.docker.com/explore/ ,调用以下API:

https://hub.docker.com/v2/repositories/library/?page=1&page_size=15

默认filter是通过递减计数,它会给你以下的回应:

 { "count": 139, "next": "https://hub.docker.com/v2/repositories/library/?page=1&page_size=15", "previous": null, "results": [{ "user": "library", "name": "nginx", "namespace": "library", "repository_type": "image", "status": 1, "description": "Official build of Nginx.", "is_private": false, "is_automated": false, "can_edit": false, "star_count": 5777, "pull_count": 618674944, "last_updated": "2017-04-06T16:35:19.178373Z", "build_on_cloud": null }, ... ... ] } 

因此,以下内容将提供Docker集线器上的前100个docker图像:

https://hub.docker.com/v2/repositories/library/?page=1&page_size=100

page_size的最大值为100(每页100个), count是这个端点可以给(所有页面)的最大值。

例如使用curljq JSONparsing器:

 curl -s "https://hub.docker.com/v2/repositories/library/?page=1&page_size=100" | \ jq '.results' 

现在有一个来自https://store.docker.com的内部API可以从商店或dockerhub查询图像。 从dockerhub最stream行的可以检索:

https://store.docker.com/api/content/v1/products/search?page_size=100&q=%2B&source=community&type=image%2Cbundle

请求结果具有popularity数字字段。 要获得按降序stream行过滤的图像:

 curl -s "https://store.docker.com/api/content/v1/products/search?page_size=100&q=%2B&source=community&type=image%2Cbundle" | \ jq '.summaries | sort_by(-.popularity)'