Finding the layers and layer sizes for each Docker image

后端 未结 11 1718
自闭症患者
自闭症患者 2020-12-04 06:47

For research purposes I\'m trying to crawl the public Docker registry ( https://registry.hub.docker.com/ ) and find out 1) how many layers an average image has and 2) the si

11条回答
  •  甜味超标
    2020-12-04 07:24

    It's indeed doable to query the manifest or blob info from docker registry server without pulling the image to local disk.

    You can refer to the Registry v2 API to fetch the manifest of image.

    GET /v2//manifests/
    

    Note, you have to handle different manifest version. For v2 you can directly get the size of layer and digest of blob. For v1 manifest, you can HEAD the blob download url to get the actual layer size.

    There is a simple script for handling above cases that will be continuously maintained.

提交回复
热议问题