summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2015-06-16 17:07:11 -0700
committerJoffrey F <joffrey@docker.com>2015-06-18 20:38:52 +0200
commit4ec36c80a9951f0fbaeefe7bf82a2e8ea7f0cc85 (patch)
tree3b98fb67aa7b5f19914703d644f7ce4dd50675d7
parent26531f1f8d77bd99bd269639163fd0d60efdea9f (diff)
downloaddocker-py-4ec36c80a9951f0fbaeefe7bf82a2e8ea7f0cc85.tar.gz
Only allow volume_driver param if API version >= 1.19
-rw-r--r--docker/utils/utils.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/docker/utils/utils.py b/docker/utils/utils.py
index 4ecdf6b..84acca3 100644
--- a/docker/utils/utils.py
+++ b/docker/utils/utils.py
@@ -500,10 +500,15 @@ def create_container_config(
]
if labels is not None and compare_version('1.18', version) < 0:
- raise errors.DockerException(
+ raise errors.InvalidVersion(
'labels were only introduced in API version 1.18'
)
+ if volume_driver is not None and compare_version('1.19', version) < 0:
+ raise errors.InvalidVersion(
+ 'Volume drivers were only introduced in API version 1.19'
+ )
+
if isinstance(labels, list):
labels = dict((lbl, six.text_type('')) for lbl in labels)
@@ -557,9 +562,9 @@ def create_container_config(
message = ('{0!r} parameter has no effect on create_container().'
' It has been moved to start()')
if dns is not None:
- raise errors.DockerException(message.format('dns'))
+ raise errors.InvalidVersion(message.format('dns'))
if volumes_from is not None:
- raise errors.DockerException(message.format('volumes_from'))
+ raise errors.InvalidVersion(message.format('volumes_from'))
return {
'Hostname': hostname,