mirror of https://github.com/docker/docker-py.git
Add and document a decode parameter for build
This makes the build method consistent with the events method and adds some convenience.
This commit is contained in:
parent
badc5b69ad
commit
3a32be79d3
|
@ -307,7 +307,8 @@ class Client(requests.Session):
|
||||||
def build(self, path=None, tag=None, quiet=False, fileobj=None,
|
def build(self, path=None, tag=None, quiet=False, fileobj=None,
|
||||||
nocache=False, rm=False, stream=False, timeout=None,
|
nocache=False, rm=False, stream=False, timeout=None,
|
||||||
custom_context=False, encoding=None, pull=True,
|
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
|
remote = context = headers = None
|
||||||
container_limits = container_limits or {}
|
container_limits = container_limits or {}
|
||||||
if path is None and fileobj is None:
|
if path is None and fileobj is None:
|
||||||
|
@ -398,7 +399,7 @@ class Client(requests.Session):
|
||||||
context.close()
|
context.close()
|
||||||
|
|
||||||
if stream:
|
if stream:
|
||||||
return self._stream_helper(response)
|
return self._stream_helper(response, decode=decode)
|
||||||
else:
|
else:
|
||||||
output = self._result(response)
|
output = self._result(response)
|
||||||
srch = r'Successfully built ([0-9a-f]+)'
|
srch = r'Successfully built ([0-9a-f]+)'
|
||||||
|
|
|
@ -71,6 +71,8 @@ correct value (e.g `gzip`).
|
||||||
- memswap (int): Total memory (memory + swap), -1 to disable swap
|
- memswap (int): Total memory (memory + swap), -1 to disable swap
|
||||||
- cpushares (int): CPU shares (relative weight)
|
- cpushares (int): CPU shares (relative weight)
|
||||||
- cpusetcpus (str): CPUs in which to allow exection, e.g., `"0-3"`, `"0,1"`
|
- 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
|
**Returns** (generator): A generator of the build output
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue