mirror of https://github.com/docker/docker-py.git
Add nocache build option
This commit is contained in:
parent
7380f3827f
commit
3f00c059d4
|
@ -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.
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue