@@ -16,7 +16,7 @@ def build(self, path=None, tag=None, quiet=False, fileobj=None,
16
16
decode = False , buildargs = None , gzip = False , shmsize = None ,
17
17
labels = None , cache_from = None , target = None , network_mode = None ,
18
18
squash = None , extra_hosts = None , platform = None , isolation = None ,
19
- use_config_proxy = True ):
19
+ version = None , use_config_proxy = True ):
20
20
"""
21
21
Similar to the ``docker build`` command. Either ``path`` or ``fileobj``
22
22
needs to be set. ``path`` can be a local path (to a directory
@@ -101,6 +101,10 @@ def build(self, path=None, tag=None, quiet=False, fileobj=None,
101
101
platform (str): Platform in the format ``os[/arch[/variant]]``
102
102
isolation (str): Isolation technology used during build.
103
103
Default: `None`.
104
+ version (str): Version of the builder backend to use.
105
+ - `1` is the first generation classic (deprecated) builder in the Docker daemon (default)
106
+ - `2` is [BuildKit](https://github.com/moby/buildkit)
107
+ Default: `None`.
104
108
use_config_proxy (bool): If ``True``, and if the docker client
105
109
configuration file (``~/.docker/config.json`` by default)
106
110
contains a proxy configuration, the corresponding environment
@@ -253,6 +257,13 @@ def build(self, path=None, tag=None, quiet=False, fileobj=None,
253
257
)
254
258
params ['isolation' ] = isolation
255
259
260
+ if version is not None :
261
+ if utils .version_lt (self ._version , '1.38' ):
262
+ raise errors .InvalidVersion (
263
+ 'version was only introduced in API version 1.38'
264
+ )
265
+ params ['version' ] = version
266
+
256
267
if context is not None :
257
268
headers = {'Content-Type' : 'application/tar' }
258
269
if encoding :
0 commit comments