Skip to content

Commit abbbbfb

Browse files
committed
Only allow privileged exec_create for API version >= 1.19
1 parent e1f93d9 commit abbbbfb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

docker/client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,10 +531,14 @@ def execute(self, container, cmd, detach=False, stdout=True, stderr=True,
531531

532532
return self.exec_start(create_res, detach, tty, stream)
533533

534-
def exec_create(self, container, cmd, stdout=True,
535-
stderr=True, tty=False, privileged=False):
534+
def exec_create(self, container, cmd, stdout=True, stderr=True, tty=False,
535+
privileged=False):
536536
if utils.compare_version('1.15', self._version) < 0:
537537
raise errors.InvalidVersion('Exec is not supported in API < 1.15')
538+
if privileged and utils.compare_version('1.19', self._version) < 0:
539+
raise errors.InvalidVersion(
540+
'Privileged exec is not supported in API < 1.19'
541+
)
538542
if isinstance(container, dict):
539543
container = container.get('Id')
540544
if isinstance(cmd, six.string_types):

0 commit comments

Comments
 (0)