MCPcopy
hub / github.com/docker/docker-py / load

Method load

docker/models/images.py:383–413  ·  view source on GitHub ↗

Load an image that was previously saved using :py:meth:`~docker.models.images.Image.save` (or ``docker save``). Similar to ``docker load``. Args: data (binary): Image data to be loaded. Returns: (list of :py:class:`Image`): The image

(self, data)

Source from the content-addressed store, hash-verified

381 return [self.get(r["Id"]) for r in resp]
382
383 def load(self, data):
384 """
385 Load an image that was previously saved using
386 :py:meth:`~docker.models.images.Image.save` (or ``docker save``).
387 Similar to ``docker load``.
388
389 Args:
390 data (binary): Image data to be loaded.
391
392 Returns:
393 (list of :py:class:`Image`): The images.
394
395 Raises:
396 :py:class:`docker.errors.APIError`
397 If the server returns an error.
398 """
399 resp = self.client.api.load_image(data)
400 images = []
401 for chunk in resp:
402 if 'stream' in chunk:
403 match = re.search(
404 r'(^Loaded image ID: |^Loaded image: )(.+)$',
405 chunk['stream']
406 )
407 if match:
408 image_id = match.group(2)
409 images.append(image_id)
410 if 'error' in chunk:
411 raise ImageLoadError(chunk['error'])
412
413 return [self.get(i) for i in images]
414
415 def pull(self, repository, tag=None, all_tags=False, **kwargs):
416 """

Callers 10

test_load_errorMethod · 0.80
test_save_and_loadMethod · 0.80
test_loadMethod · 0.80
load_configMethod · 0.80
load_general_configFunction · 0.80
_load_metaMethod · 0.80
get_current_context_nameFunction · 0.80
contextsMethod · 0.80

Calls 4

getMethod · 0.95
ImageLoadErrorClass · 0.85
load_imageMethod · 0.80
searchMethod · 0.45

Tested by 4

test_load_errorMethod · 0.64
test_save_and_loadMethod · 0.64
test_loadMethod · 0.64