summaryrefslogtreecommitdiff
path: root/docker/models/containers.py
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2018-01-08 18:11:29 -0800
committerJoffrey F <joffrey@docker.com>2018-01-23 16:59:09 -0800
commitf95b958429b38dab50929e013db3c636a12e1536 (patch)
treeb8de1cfd18d1c3c932592388143665f446e871f6 /docker/models/containers.py
parentbf5e7702df3c835a5db4fc6b86500b4f4b659c14 (diff)
downloaddocker-py-1855-platform-option.tar.gz
Add support for experimental platform flag in build and pull1855-platform-option
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'docker/models/containers.py')
-rw-r--r--docker/models/containers.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/docker/models/containers.py b/docker/models/containers.py
index 6ba308e..5e2aa88 100644
--- a/docker/models/containers.py
+++ b/docker/models/containers.py
@@ -579,6 +579,8 @@ class ContainerCollection(Collection):
inside the container.
pids_limit (int): Tune a container's pids limit. Set ``-1`` for
unlimited.
+ platform (str): Platform in the format ``os[/arch[/variant]]``.
+ Only used if the method needs to pull the requested image.
ports (dict): Ports to bind inside the container.
The keys of the dictionary are the ports to bind inside the
@@ -700,7 +702,9 @@ class ContainerCollection(Collection):
if isinstance(image, Image):
image = image.id
stream = kwargs.pop('stream', False)
- detach = kwargs.pop("detach", False)
+ detach = kwargs.pop('detach', False)
+ platform = kwargs.pop('platform', None)
+
if detach and remove:
if version_gte(self.client.api._version, '1.25'):
kwargs["auto_remove"] = True
@@ -718,7 +722,7 @@ class ContainerCollection(Collection):
container = self.create(image=image, command=command,
detach=detach, **kwargs)
except ImageNotFound:
- self.client.images.pull(image)
+ self.client.images.pull(image, platform=platform)
container = self.create(image=image, command=command,
detach=detach, **kwargs)