2017-04-15 111 views

回答

2

https://hub.docker.com/explore/,下面的API調用:

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

默認篩選器是通過降拉力計,它會給你以下回應:

{ 
    "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 
    }, 
    ... 
    ... 
    ] 
} 

所以下面先給您的碼頭輪轂上的前100個碼頭圖像:

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

page_size最大大小爲100(每頁100個),count是此端點可以給予的最大數量(對於所有頁面)。

例如與curljq JSON解析器:

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

現在有從https://store.docker.com內部API查詢或者從商店或從dockerhub圖像。從dockerhub最流行的可檢索:

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

請求結果具有popularity數字字段。要獲得按降序排名過濾的圖像:

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)' 
+0

我在哪裏可以找到Docker Hub的完整API參考?我只從Docker Engine和Docker Registry – fluency03

+0

找到API這是v1:https://docs.docker.com/v1.4/reference/api/docker-io_api/ – fluency03

+0

我也沒有找到它,我已經打開有一個問題[有](https://github.com/docker/docker.github.io/issues/2800)知道爲什麼這個引用不存在於https://docs.docker.com/reference/api/泊塢窗,io_api / –