Skip to content

Commit cd006bb

Browse files
committed
Fix #466
1 parent 08ce8d0 commit cd006bb

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

docker/client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,9 @@ def create_container(self, image, command=None, hostname=None, user=None,
533533
volumes = [volumes, ]
534534

535535
if host_config and utils.compare_version('1.15', self._version) < 0:
536-
raise errors.APIError('host_config is not supported in API < 1.15')
536+
raise errors.InvalidVersion(
537+
'host_config is not supported in API < 1.15'
538+
)
537539

538540
config = self._container_config(
539541
image, command, hostname, user, detach, stdin_open, tty, mem_limit,
@@ -563,7 +565,7 @@ def events(self):
563565
def execute(self, container, cmd, detach=False, stdout=True, stderr=True,
564566
stream=False, tty=False):
565567
if utils.compare_version('1.15', self._version) < 0:
566-
raise errors.APIError('Exec is not supported in API < 1.15')
568+
raise errors.InvalidVersion('Exec is not supported in API < 1.15')
567569
if isinstance(container, dict):
568570
container = container.get('Id')
569571
if isinstance(cmd, six.string_types):
@@ -911,11 +913,11 @@ def start(self, container, binds=None, port_bindings=None, lxc_conf=None,
911913

912914
if utils.compare_version('1.10', self._version) < 0:
913915
if dns is not None:
914-
raise errors.APIError(
916+
raise errors.InvalidVersion(
915917
'dns is only supported for API version >= 1.10'
916918
)
917919
if volumes_from is not None:
918-
raise errors.APIError(
920+
raise errors.InvalidVersion(
919921
'volumes_from is only supported for API version >= 1.10'
920922
)
921923

docker/errors.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ class DockerException(Exception):
5353
pass
5454

5555

56+
class InvalidVersion(DockerException):
57+
pass
58+
59+
5660
class InvalidRepository(DockerException):
5761
pass
5862

0 commit comments

Comments
 (0)