summaryrefslogtreecommitdiff
path: root/docker/models
diff options
context:
space:
mode:
Diffstat (limited to 'docker/models')
-rw-r--r--docker/models/containers.py8
-rw-r--r--docker/models/images.py2
2 files changed, 8 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)
diff --git a/docker/models/images.py b/docker/models/images.py
index 82ca541..891c565 100644
--- a/docker/models/images.py
+++ b/docker/models/images.py
@@ -157,6 +157,7 @@ class ImageCollection(Collection):
single layer.
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]]``.
Returns:
(:py:class:`Image`): The built image.
@@ -265,6 +266,7 @@ class ImageCollection(Collection):
:py:meth:`~docker.client.DockerClient.login` has set for
this request. ``auth_config`` should contain the ``username``
and ``password`` keys to be valid.
+ platform (str): Platform in the format ``os[/arch[/variant]]``
Returns:
(:py:class:`Image`): The image that has been pulled.