File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -241,13 +241,24 @@ def load(self, data):
241
241
data (binary): Image data to be loaded.
242
242
243
243
Returns:
244
- (generator ): Progress output as JSON objects
244
+ (list of :py:class:`Image` ): The images.
245
245
246
246
Raises:
247
247
:py:class:`docker.errors.APIError`
248
248
If the server returns an error.
249
249
"""
250
- return self .client .api .load_image (data )
250
+ resp = self .client .api .load_image (data )
251
+ images = []
252
+ for chunk in resp :
253
+ if 'stream' in chunk :
254
+ match = re .search (
255
+ r'(^Loaded image ID: |^Loaded image: )(.+)$' ,
256
+ chunk ['stream' ]
257
+ )
258
+ if match :
259
+ image_id = match .group (2 )
260
+ images .append (image_id )
261
+ return [self .get (i ) for i in images ]
251
262
252
263
def pull (self , name , tag = None , ** kwargs ):
253
264
"""
You can’t perform that action at this time.
0 commit comments