Use better version comparison function

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2017-08-15 17:40:07 -07:00 committed by Joffrey F
parent 6b59dc6271
commit d5c4ce203a
1 changed files with 2 additions and 3 deletions

View File

@ -4,7 +4,7 @@ from ..api import APIClient
from ..errors import (ContainerError, ImageNotFound,
create_unexpected_kwargs_error)
from ..types import HostConfig
from ..utils import compare_version
from ..utils import version_gte
from .images import Image
from .resource import Collection, Model
@ -691,8 +691,7 @@ class ContainerCollection(Collection):
image = image.id
detach = kwargs.pop("detach", False)
if detach and remove:
if compare_version("1.24",
self.client.api._version) > 0:
if version_gte(self.client.api._version, '1.25'):
kwargs["auto_remove"] = True
else:
raise RuntimeError("The options 'detach' and 'remove' cannot "