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

Method load_image

docker/api/image.py:291–324  ·  view source on GitHub ↗

Load an image that was previously saved using :py:meth:`~docker.api.image.ImageApiMixin.get_image` (or ``docker save``). Similar to ``docker load``. Args: data (binary): Image data to be loaded. quiet (boolean): Suppress progress details in r

(self, data, quiet=None)

Source from the content-addressed store, hash-verified

289 )
290
291 def load_image(self, data, quiet=None):
292 """
293 Load an image that was previously saved using
294 :py:meth:`~docker.api.image.ImageApiMixin.get_image` (or ``docker
295 save``). Similar to ``docker load``.
296
297 Args:
298 data (binary): Image data to be loaded.
299 quiet (boolean): Suppress progress details in response.
300
301 Returns:
302 (generator): Progress output as JSON objects. Only available for
303 API version >= 1.23
304
305 Raises:
306 :py:class:`docker.errors.APIError`
307 If the server returns an error.
308 """
309 params = {}
310
311 if quiet is not None:
312 if utils.version_lt(self._version, '1.23'):
313 raise errors.InvalidVersion(
314 'quiet is not supported in API version < 1.23'
315 )
316 params['quiet'] = quiet
317
318 res = self._post(
319 self._url("/images/load"), data=data, params=params, stream=True
320 )
321 if utils.version_gte(self._version, '1.23'):
322 return self._stream_helper(res, decode=True)
323
324 self._raise_for_status(res)
325
326 @utils.minimum_version('1.25')
327 def prune_images(self, filters=None):

Callers 5

test_get_load_imageMethod · 0.80
test_load_imageMethod · 0.80
test_load_image_quietMethod · 0.80
loadMethod · 0.80

Calls 4

_postMethod · 0.80
_urlMethod · 0.80
_stream_helperMethod · 0.80
_raise_for_statusMethod · 0.80

Tested by 4

test_get_load_imageMethod · 0.64
test_load_imageMethod · 0.64
test_load_image_quietMethod · 0.64