@@ -323,7 +323,8 @@ def prune_images(self, filters=None):
323
323
return self ._result (self ._post (url , params = params ), True )
324
324
325
325
def pull (self , repository , tag = None , stream = False ,
326
- insecure_registry = False , auth_config = None , decode = False ):
326
+ insecure_registry = False , auth_config = None , decode = False ,
327
+ platform = None ):
327
328
"""
328
329
Pulls an image. Similar to the ``docker pull`` command.
329
330
@@ -336,6 +337,7 @@ def pull(self, repository, tag=None, stream=False,
336
337
:py:meth:`~docker.api.daemon.DaemonApiMixin.login` has set for
337
338
this request. ``auth_config`` should contain the ``username``
338
339
and ``password`` keys to be valid.
340
+ platform (str): Platform in the format ``os[/arch[/variant]]``
339
341
340
342
Returns:
341
343
(generator or str): The output
@@ -376,7 +378,7 @@ def pull(self, repository, tag=None, stream=False,
376
378
}
377
379
headers = {}
378
380
379
- if utils .compare_version ( '1.5' , self . _version ) >= 0 :
381
+ if utils .version_gte ( self . _version , '1.5' ) :
380
382
if auth_config is None :
381
383
header = auth .get_config_header (self , registry )
382
384
if header :
@@ -385,6 +387,13 @@ def pull(self, repository, tag=None, stream=False,
385
387
log .debug ('Sending supplied auth config' )
386
388
headers ['X-Registry-Auth' ] = auth .encode_header (auth_config )
387
389
390
+ if platform is not None :
391
+ if utils .version_lt (self ._version , '1.32' ):
392
+ raise errors .InvalidVersion (
393
+ 'platform was only introduced in API version 1.32'
394
+ )
395
+ params ['platform' ] = platform
396
+
388
397
response = self ._post (
389
398
self ._url ('/images/create' ), params = params , headers = headers ,
390
399
stream = stream , timeout = None
0 commit comments