2016-10-04 68 views
0

我想獲得一些關於Docker鏡像發佈的版本/標籤的基本信息,以瞭解我可以拖放哪個image:tag。我也想看看每個標籤最近發佈的時間。獲取可從命令行拉取的docker標記列表?

有沒有辦法在命令行上做到這一點?

Docker version 1.10.2, build c3959b1 

基本上尋找碼頭圖像的等效npm info {pkg}

回答

1

不是從命令行。你有docker search但它只返回所需的數據的一個子集,只爲與:latest標籤的圖像:

> docker search sixeyed/hadoop-dotnet 
NAME     DESCRIPTION      STARS  OFFICIAL AUTOMATED 
sixeyed/hadoop-dotnet Hadoop with .NET Core installed 1     [OK] 

如果您想了解更多的細節,你需要使用registry API,但只有它有列出存儲庫的目錄端點,issue for search仍處於打開狀態。

假設你知道倉庫的名稱,你可以瀏覽API - 首先你需要一個身份驗證令牌:

> curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:sixeyed/hadoop-dotnet:pull" 
{"token":"eyJhbG... 

然後傳遞令牌後續請求,例如列出標籤:

> curl --header "Authorization: Bearer eyJh..." https://index.docker.io/v2/sixeyed/hadoop-dotnet/tags/list 
{"name":"sixeyed/hadoop-dotnet","tags":["2.7.2","latest"]} 

然後由它的倉庫名稱和標記獲取一個圖像的所有信息:

> curl --header "Authorization: Bearer eyJh..." https://index.docker.io/v2/sixeyed/hadoop-dotnet/manifests/latest 
+0

你可以添加對最終的請求的示例響應? – nephets

+0

它是JSON的170行...開頭:'「架構」:「amd64」 , 「fsLayers」:[ { 「blobSum」:「sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4」 } ...' –