Fix verbs support in V2
This commit is contained in:
parent
cf030e2a98
commit
1450b7e84c
9 changed files with 64 additions and 44 deletions
|
@ -20,7 +20,8 @@ class SquashedDockerImage(TarImageFormatter):
|
|||
"""
|
||||
|
||||
def stream_generator(self, namespace, repository, tag, synthetic_image_id,
|
||||
layer_json, get_image_iterator, get_layer_iterator):
|
||||
layer_json, get_image_iterator, get_layer_iterator, get_image_json):
|
||||
|
||||
# Docker import V1 Format (.tar):
|
||||
# repositories - JSON file containing a repo -> tag -> image map
|
||||
# {image ID folder}:
|
||||
|
@ -52,7 +53,14 @@ class SquashedDockerImage(TarImageFormatter):
|
|||
# Yield the merged layer data's header.
|
||||
estimated_file_size = 0
|
||||
for image in get_image_iterator():
|
||||
estimated_file_size += image.storage.uncompressed_size
|
||||
# In V1 we have the actual uncompressed size, which is needed for back compat with
|
||||
# older versions of Docker.
|
||||
# In V2, we use the size given in the image JSON.
|
||||
if image.storage.uncompressed_size:
|
||||
estimated_file_size += image.storage.uncompressed_size
|
||||
else:
|
||||
image_json = get_image_json(image)
|
||||
estimated_file_size += image_json.get('Size', 0)
|
||||
|
||||
yield self.tar_file_header(synthetic_image_id + '/layer.tar', estimated_file_size)
|
||||
|
||||
|
|
Reference in a new issue