使用Docker API提取图像会提取给定图像的所有标签

时间:2019-01-28 17:01:38

标签: docker docker-image docker-api

在使用Docker API提取centos映像时,根据文档here,它开始下载centos的所有可能映像(5、5.11、6、6.10等):

{"status":"Pulling from library/centos","id":"6.10"}
{"status":"Pulling fs layer","progressDetail":{},"id":"1c8f9aa56c90"}
{"status":"Downloading","progressDetail":{"current":539797,"total":69804062},"progress":"[\u003e                                                  ]  539.8kB/69.8MB","id":"1c8f9aa56c90"}
{"status":"Downloading","progressDetail":{"current":5917381,"total":69804062},"progress":"[====\u003e                                              ]  5.917MB/69.8MB","id":"1c8f9aa56c90"}
{"status":"Downloading","progressDetail":{"current":12896965,"total":69804062},"progress":"[=========\u003e                                         ]   12.9MB/69.8MB","id":"1c8f9aa56c90"}
...
{"status":"Downloading","progressDetail":{"current":59587269,"total":69804062},"progress":"[==========================================\u003e        ]  59.59MB/69.8MB","id":"1c8f9aa56c90"}
{"status":"Downloading","progressDetail":{"current":64400069,"total":69804062},"progress":"[==============================================\u003e    ]   64.4MB/69.8MB","id":"1c8f9aa56c90"}
{"status":"Verifying Checksum","progressDetail":{},"id":"1c8f9aa56c90"}
{"status":"Download complete","progressDetail":{},"id":"1c8f9aa56c90"}
{"status":"Extracting","progressDetail":{"current":557056,"total":69804062},"progress":"[\u003e                                                  ]  557.1kB/69.8MB","id":"1c8f9aa56c90"}
{"status":"Extracting","progressDetail":{"current":2228224,"total":69804062},"progress":"[=\u003e                                                 ]  2.228MB/69.8MB","id":"1c8f9aa56c90"}
{"status":"Extracting","progressDetail":{"current":3342336,"total":69804062},"progress":"[==\u003e                                                ]  3.342MB/69.8MB","id":"1c8f9aa56c90"}
...
{"status":"Extracting","progressDetail":{"current":15597568,"total":69804062},"progress":"[===========\u003e                                       ]   15.6MB/69.8MB","id":"1c8f9aa56c90"}
/home # {"status":"Extracting","progressDetail":{"current":16711680,"total":69804062},"progress":"[===========\u003e                                       ]  16.71MB/69.8MB","id":"1c8f9aa56c90"}
{"status":"Extracting","progressDetail":{"current":18382848,"total":69804062},"progress":"[=============\u003e                                     ]  18.38MB/69.8MB","id":"1c8f9aa56c90"}
{"status":"Extracting","progressDetail":{"current":20054016,"total":69804062},"progress":"[==============\u003e                                    ]  20.05MB/69.8MB","id":"1c8f9aa56c90"}
{"status":"Extracting","progressDetail":{"current":20611072,"total":69804062},"progress":"[==============\u003e                                    ]  20.61MB/69.8MB","id":"1c8f9aa56c90"}
{"status":"Extracting","progressDetail":{"current":21725184,"total":69804062},"progress":"[===============\u003e                                   ]  21.73MB/69.8MB","id":"1c8f9aa56c90"}
{"status":"Extracting","progressDetail":{"current":23396352,"total":69804062},"progress":"[================\u003e                                  ]   23.4MB/69.8MB","id":"1c8f9aa56c90"}
...
{"status":"Extracting","progressDetail":{"current":69804062,"total":69804062},"progress":"[==================================================\u003e]   69.8MB/69.8MB","id":"1c8f9aa56c90"}
{"status":"Pull complete","progressDetail":{},"id":"1c8f9aa56c90"}
{"status":"Digest: sha256:b4c3fe75b135ca1c26ef6feb8153aade8a31c4e3e763376529c1088de7e973f4"}
{"status":"Pulling from library/centos","id":"6.6"}
{"status":"Pulling fs layer","progressDetail":{},"id":"f9f73d801f05"}
{"status":"Downloading","progressDetail":{"current":539318,"total":73694253},"progress":"[\u003e                                                  ]  539.3kB/73.69MB","id":"f9f73d801f05"}
{"status":"Downloading","progressDetail":{"current":7477942,"total":73694253},"progress":"[=====\u003e                                             ]  7.478MB/73.69MB","id":"f9f73d801f05"}
...
{"status":"Downloading","progressDetail":{"current":50543286,"total":73694253},"progress":"[==================================\u003e                ]  50.54MB/73.69MB","id":"f9f73d801f05"}
{"status":"Downloading","progressDetail":{"current":55929526,"total":73694253},"progress":"[=====================================\u003e             ]  55.93MB/73.69MB","id":"f9f73d801f05"}

我使用了以下API:

curl -X POST -H "Content-Type: application/json" --unix-socket /var/run/docker.sock http://v1.27/images/create?fromImage=centos&tag=latest 

他们提到我需要指定tag参数,以防止下载所有图像:

  

标记或摘要。如果拉动图像时为空,则会导致所有标签   以便将给定的图像拉出。

我做到了,仍然下载了所有图像。

0 个答案:

没有答案