Skip to content

Commit 08444cf

Browse files
committed
Merge branch 'tonicbupt-privilege'
2 parents d600073 + abbbbfb commit 08444cf

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docker/client.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,9 +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, stderr=True, tty=False):
534+
def exec_create(self, container, cmd, stdout=True, stderr=True, tty=False,
535+
privileged=False):
535536
if utils.compare_version('1.15', self._version) < 0:
536537
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+
)
537542
if isinstance(container, dict):
538543
container = container.get('Id')
539544
if isinstance(cmd, six.string_types):
@@ -542,7 +547,7 @@ def exec_create(self, container, cmd, stdout=True, stderr=True, tty=False):
542547
data = {
543548
'Container': container,
544549
'User': '',
545-
'Privileged': False,
550+
'Privileged': privileged,
546551
'Tty': tty,
547552
'AttachStdin': False,
548553
'AttachStdout': stdout,

0 commit comments

Comments
 (0)