mirror of https://github.com/docker/docker-py.git
Allow for pull as an option to docker build
Signed-off-by: Derek Hammer <derek.r.hammer@gmail.com>
This commit is contained in:
parent
4a7bb9a9b0
commit
d8e8400419
|
|
@ -408,7 +408,7 @@ 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=False, custom_context=False, encoding=None):
|
||||
remote = context = headers = None
|
||||
if path is None and fileobj is None:
|
||||
raise TypeError("Either path or fileobj needs to be provided.")
|
||||
|
|
@ -439,6 +439,7 @@ class Client(requests.Session):
|
|||
params = {
|
||||
't': tag,
|
||||
'remote': remote,
|
||||
'pull': pull,
|
||||
'q': quiet,
|
||||
'nocache': nocache,
|
||||
'rm': rm
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ correct value (e.g `gzip`).
|
|||
* stream (bool): Return a blocking generator you can iterate over to retrieve
|
||||
build output as it happens
|
||||
* timeout (int): HTTP timeout
|
||||
* pull (bool): Downloads any updates to the FROM image in Dockerfiles
|
||||
* custom_context (bool): Optional if using `fileobj`
|
||||
* encoding (str): The encoding for a stream. Set to `gzip` for compressing
|
||||
|
||||
|
|
|
|||
|
|
@ -1677,6 +1677,20 @@ class DockerClientTest(Cleanup, unittest.TestCase):
|
|||
except Exception as e:
|
||||
self.fail('Command should not raise exception: {0}'.format(e))
|
||||
|
||||
def test_build_container_pull(self):
|
||||
script = io.BytesIO('\n'.join([
|
||||
'FROM busybox',
|
||||
'MAINTAINER docker-py',
|
||||
'RUN mkdir -p /tmp/test',
|
||||
'EXPOSE 8080',
|
||||
'ADD https://dl.dropboxusercontent.com/u/20637798/silence.tar.gz'
|
||||
' /tmp/silence.tar.gz'
|
||||
]).encode('ascii'))
|
||||
try:
|
||||
self.client.build(fileobj=script, pull=True)
|
||||
except Exception as e:
|
||||
self.fail('Command should not raise exception: {0}'.format(e))
|
||||
|
||||
def test_build_container_stream(self):
|
||||
script = io.BytesIO('\n'.join([
|
||||
'FROM busybox',
|
||||
|
|
|
|||
Loading…
Reference in New Issue