summaryrefslogtreecommitdiff
path: root/docker/models/images.py
diff options
context:
space:
mode:
Diffstat (limited to 'docker/models/images.py')
-rw-r--r--docker/models/images.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/docker/models/images.py b/docker/models/images.py
index 0f3c71a..d604f7c 100644
--- a/docker/models/images.py
+++ b/docker/models/images.py
@@ -4,6 +4,7 @@ import re
import six
from ..api import APIClient
+from ..constants import DEFAULT_DATA_CHUNK_SIZE
from ..errors import BuildError, ImageLoadError
from ..utils import parse_repository_tag
from ..utils.json_stream import json_stream
@@ -58,10 +59,15 @@ class Image(Model):
"""
return self.client.api.history(self.id)
- def save(self):
+ def save(self, chunk_size=DEFAULT_DATA_CHUNK_SIZE):
"""
Get a tarball of an image. Similar to the ``docker save`` command.
+ Args:
+ chunk_size (int): The number of bytes returned by each iteration
+ of the generator. If ``None``, data will be streamed as it is
+ received. Default: 2 MB
+
Returns:
(generator): A stream of raw archive data.
@@ -77,7 +83,7 @@ class Image(Model):
>>> f.write(chunk)
>>> f.close()
"""
- return self.client.api.get_image(self.id)
+ return self.client.api.get_image(self.id, chunk_size)
def tag(self, repository, tag=None, **kwargs):
"""