MCPcopy Index your code
hub / github.com/docker/docker-py / get_image

Method get_image

docker/api/image.py:13–39  ·  view source on GitHub ↗

Get a tarball of an image. Similar to the ``docker save`` command. Args: image (str): Image name to get chunk_size (int): The number of bytes returned by each iteration of the generator. If ``None``, data will be streamed as it is

(self, image, chunk_size=DEFAULT_DATA_CHUNK_SIZE)

Source from the content-addressed store, hash-verified

11
12 @utils.check_resource('image')
13 def get_image(self, image, chunk_size=DEFAULT_DATA_CHUNK_SIZE):
14 """
15 Get a tarball of an image. Similar to the ``docker save`` command.
16
17 Args:
18 image (str): Image name to get
19 chunk_size (int): The number of bytes returned by each iteration
20 of the generator. If ``None``, data will be streamed as it is
21 received. Default: 2 MB
22
23 Returns:
24 (generator): A stream of raw archive data.
25
26 Raises:
27 :py:class:`docker.errors.APIError`
28 If the server returns an error.
29
30 Example:
31
32 >>> image = client.api.get_image("busybox:latest")
33 >>> f = open('/tmp/busybox-latest.tar', 'wb')
34 >>> for chunk in image:
35 >>> f.write(chunk)
36 >>> f.close()
37 """
38 res = self._get(self._url("/images/{0}/get", image), stream=True)
39 return self._stream_raw_result(res, chunk_size, False)
40
41 @utils.check_resource('image')
42 def history(self, image):

Callers 4

test_get_load_imageMethod · 0.80
test_get_imageMethod · 0.80
saveMethod · 0.80

Calls 3

_getMethod · 0.80
_urlMethod · 0.80
_stream_raw_resultMethod · 0.80

Tested by 3

test_get_load_imageMethod · 0.64
test_get_imageMethod · 0.64