mirror of https://github.com/docker/docker-py.git
Add isolation param to build
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
73a9003758
commit
27322fede7
|
@ -18,7 +18,7 @@ class BuildApiMixin(object):
|
|||
forcerm=False, dockerfile=None, container_limits=None,
|
||||
decode=False, buildargs=None, gzip=False, shmsize=None,
|
||||
labels=None, cache_from=None, target=None, network_mode=None,
|
||||
squash=None, extra_hosts=None, platform=None):
|
||||
squash=None, extra_hosts=None, platform=None, isolation=None):
|
||||
"""
|
||||
Similar to the ``docker build`` command. Either ``path`` or ``fileobj``
|
||||
needs to be set. ``path`` can be a local path (to a directory
|
||||
|
@ -100,6 +100,8 @@ class BuildApiMixin(object):
|
|||
extra_hosts (dict): Extra hosts to add to /etc/hosts in building
|
||||
containers, as a mapping of hostname to IP address.
|
||||
platform (str): Platform in the format ``os[/arch[/variant]]``
|
||||
isolation (str): Isolation technology used during build.
|
||||
Default: `None`.
|
||||
|
||||
Returns:
|
||||
A generator for the build output.
|
||||
|
@ -232,6 +234,13 @@ class BuildApiMixin(object):
|
|||
)
|
||||
params['platform'] = platform
|
||||
|
||||
if isolation is not None:
|
||||
if utils.version_lt(self._version, '1.24'):
|
||||
raise errors.InvalidVersion(
|
||||
'isolation was only introduced in API version 1.24'
|
||||
)
|
||||
params['isolation'] = isolation
|
||||
|
||||
if context is not None:
|
||||
headers = {'Content-Type': 'application/tar'}
|
||||
if encoding:
|
||||
|
|
|
@ -164,6 +164,8 @@ class ImageCollection(Collection):
|
|||
extra_hosts (dict): Extra hosts to add to /etc/hosts in building
|
||||
containers, as a mapping of hostname to IP address.
|
||||
platform (str): Platform in the format ``os[/arch[/variant]]``.
|
||||
isolation (str): Isolation technology used during build.
|
||||
Default: `None`.
|
||||
|
||||
Returns:
|
||||
(tuple): The first item is the :py:class:`Image` object for the
|
||||
|
|
|
@ -138,6 +138,21 @@ class BuildTest(BaseAPIIntegrationTest):
|
|||
# There is currently no way to get the shmsize
|
||||
# that was used to build the image
|
||||
|
||||
@requires_api_version('1.24')
|
||||
def test_build_isolation(self):
|
||||
script = io.BytesIO('\n'.join([
|
||||
'FROM scratch',
|
||||
'CMD sh -c "echo \'Deaf To All But The Song\''
|
||||
]).encode('ascii'))
|
||||
|
||||
stream = self.client.build(
|
||||
fileobj=script, tag='isolation',
|
||||
isolation='default'
|
||||
)
|
||||
|
||||
for chunk in stream:
|
||||
pass
|
||||
|
||||
@requires_api_version('1.23')
|
||||
def test_build_labels(self):
|
||||
script = io.BytesIO('\n'.join([
|
||||
|
|
Loading…
Reference in New Issue