mirror of https://github.com/docker/docker-py.git
Fix pulling with container create api
Fix the pulling issue stated in #2635. Basically, similar to `docker create` it should pull the image if it does not exist locally. Signed-off-by: Navid Ali Pour <navid9675@gmail.com>
This commit is contained in:
parent
b4beaaac8c
commit
b37a25d70b
|
@ -864,8 +864,14 @@ class ContainerCollection(Collection):
|
|||
kwargs['image'] = image
|
||||
kwargs['command'] = command
|
||||
kwargs['version'] = self.client.api._version
|
||||
platform = kwargs.pop('platform', None)
|
||||
create_kwargs = _create_container_args(kwargs)
|
||||
resp = self.client.api.create_container(**create_kwargs)
|
||||
try:
|
||||
resp = self.client.api.create_container(**create_kwargs)
|
||||
except ImageNotFound:
|
||||
self.client.images.pull(image, platform=platform)
|
||||
resp = self.client.api.create_container(**create_kwargs)
|
||||
|
||||
return self.get(resp['Id'])
|
||||
|
||||
def get(self, container_id):
|
||||
|
|
Loading…
Reference in New Issue