Add nocache build option

This commit is contained in:
Ben Whaley 2013-08-14 16:48:54 -07:00
parent 7380f3827f
commit 3f00c059d4
2 changed files with 3 additions and 3 deletions

View File

@ -10,7 +10,7 @@ API
Client class. `base_url` refers to the protocol+hostname+port where the docker Client class. `base_url` refers to the protocol+hostname+port where the docker
server is hosted. Version is the version of the API the client will use. server is hosted. Version is the version of the API the client will use.
* `c.build(path=None, tag=None, quiet=False, fileobj=None)` * `c.build(path=None, tag=None, quiet=False, fileobj=None, nocache=False)`
Similar to the `docker build` command. Either `path` or `fileobj` needs to be Similar to the `docker build` command. Either `path` or `fileobj` needs to be
set. `path` can be a local path (to a directory containing a Dockerfile) or a set. `path` can be a local path (to a directory containing a Dockerfile) or a
remote URL. `fileobj` must be a readable file-like object to a Dockerfile. remote URL. `fileobj` must be a readable file-like object to a Dockerfile.

View File

@ -213,7 +213,7 @@ class Client(requests.Session):
else: else:
break break
def build(self, path=None, tag=None, quiet=False, fileobj=None): def build(self, path=None, tag=None, quiet=False, fileobj=None, nocache=False):
remote = context = headers = None remote = context = headers = None
if path is None and fileobj is None: if path is None and fileobj is None:
raise Exception("Either path or fileobj needs to be provided.") raise Exception("Either path or fileobj needs to be provided.")
@ -227,7 +227,7 @@ class Client(requests.Session):
context = self._tar(path) context = self._tar(path)
u = self._url('/build') u = self._url('/build')
params = { 'tag': tag, 'remote': remote, 'q': quiet } params = { 'tag': tag, 'remote': remote, 'q': quiet, 'nocache': nocache }
if context is not None: if context is not None:
headers = { 'Content-Type': 'application/tar' } headers = { 'Content-Type': 'application/tar' }
res = self._result(self.post(u, context, params=params, res = self._result(self.post(u, context, params=params,