summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Möller <bootsarehax@gmail.com>2015-06-15 10:29:00 +0200
committerJoffrey F <joffrey@docker.com>2015-06-18 20:38:21 +0200
commit3a32be79d310982b598ca2c9a391180c87099dae (patch)
tree4b7a1a04ddfb43993fbc518e36fb399373c20beb
parentbadc5b69adb82a50df80e4558bfc0fe6d5cd474e (diff)
downloaddocker-py-3a32be79d310982b598ca2c9a391180c87099dae.tar.gz
Add and document a decode parameter for build
This makes the build method consistent with the events method and adds some convenience.
-rw-r--r--docker/client.py5
-rw-r--r--docs/api.md2
2 files changed, 5 insertions, 2 deletions
diff --git a/docker/client.py b/docker/client.py
index 4607971..e602250 100644
--- a/docker/client.py
+++ b/docker/client.py
@@ -307,7 +307,8 @@ class Client(requests.Session):
def build(self, path=None, tag=None, quiet=False, fileobj=None,
nocache=False, rm=False, stream=False, timeout=None,
custom_context=False, encoding=None, pull=True,
- forcerm=False, dockerfile=None, container_limits=None):
+ forcerm=False, dockerfile=None, container_limits=None,
+ decode=False):
remote = context = headers = None
container_limits = container_limits or {}
if path is None and fileobj is None:
@@ -398,7 +399,7 @@ class Client(requests.Session):
context.close()
if stream:
- return self._stream_helper(response)
+ return self._stream_helper(response, decode=decode)
else:
output = self._result(response)
srch = r'Successfully built ([0-9a-f]+)'
diff --git a/docs/api.md b/docs/api.md
index 3b3a144..19048e3 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -71,6 +71,8 @@ correct value (e.g `gzip`).
- memswap (int): Total memory (memory + swap), -1 to disable swap
- cpushares (int): CPU shares (relative weight)
- cpusetcpus (str): CPUs in which to allow exection, e.g., `"0-3"`, `"0,1"`
+* decode (bool): If set to true, the returned stream will be decoded into dicts on the fly.
+ False by default.
**Returns** (generator): A generator of the build output