Skip to content

Commit 4ec36c8

Browse files
committed
Only allow volume_driver param if API version >= 1.19
1 parent 26531f1 commit 4ec36c8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

docker/utils/utils.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,15 @@ def create_container_config(
500500
]
501501

502502
if labels is not None and compare_version('1.18', version) < 0:
503-
raise errors.DockerException(
503+
raise errors.InvalidVersion(
504504
'labels were only introduced in API version 1.18'
505505
)
506506

507+
if volume_driver is not None and compare_version('1.19', version) < 0:
508+
raise errors.InvalidVersion(
509+
'Volume drivers were only introduced in API version 1.19'
510+
)
511+
507512
if isinstance(labels, list):
508513
labels = dict((lbl, six.text_type('')) for lbl in labels)
509514

@@ -557,9 +562,9 @@ def create_container_config(
557562
message = ('{0!r} parameter has no effect on create_container().'
558563
' It has been moved to start()')
559564
if dns is not None:
560-
raise errors.DockerException(message.format('dns'))
565+
raise errors.InvalidVersion(message.format('dns'))
561566
if volumes_from is not None:
562-
raise errors.DockerException(message.format('volumes_from'))
567+
raise errors.InvalidVersion(message.format('volumes_from'))
563568

564569
return {
565570
'Hostname': hostname,

0 commit comments

Comments
 (0)