@@ -434,7 +434,7 @@ def pull(self, repository, tag=None, stream=False, auth_config=None,
434
434
return self ._result (response )
435
435
436
436
def push (self , repository , tag = None , stream = False , auth_config = None ,
437
- decode = False ):
437
+ decode = False , platform = None ):
438
438
"""
439
439
Push an image or a repository to the registry. Similar to the ``docker
440
440
push`` command.
@@ -448,6 +448,7 @@ def push(self, repository, tag=None, stream=False, auth_config=None,
448
448
``username`` and ``password`` keys to be valid.
449
449
decode (bool): Decode the JSON data from the server into dicts.
450
450
Only applies with ``stream=True``
451
+ platform (str): JSON-encoded OCI platform to select the platform-variant to push. If not provided, all available variants will attempt to be pushed.
451
452
452
453
Returns:
453
454
(generator or str): The output from the server.
@@ -488,6 +489,13 @@ def push(self, repository, tag=None, stream=False, auth_config=None,
488
489
log .debug ('Sending supplied auth config' )
489
490
headers ['X-Registry-Auth' ] = auth .encode_header (auth_config )
490
491
492
+ if platform is not None :
493
+ if utils .version_lt (self ._version , '1.46' ):
494
+ raise errors .InvalidVersion (
495
+ 'platform was only introduced in API version 1.46'
496
+ )
497
+ params ['platform' ] = platform
498
+
491
499
response = self ._post_json (
492
500
u , None , headers = headers , stream = stream , params = params
493
501
)
0 commit comments