mirror of https://github.com/docker/docker-py.git
Only allow privileged exec_create for API version >= 1.19
This commit is contained in:
parent
e1f93d95c9
commit
abbbbfb2d6
|
|
@ -531,10 +531,14 @@ class Client(requests.Session):
|
||||||
|
|
||||||
return self.exec_start(create_res, detach, tty, stream)
|
return self.exec_start(create_res, detach, tty, stream)
|
||||||
|
|
||||||
def exec_create(self, container, cmd, stdout=True,
|
def exec_create(self, container, cmd, stdout=True, stderr=True, tty=False,
|
||||||
stderr=True, tty=False, privileged=False):
|
privileged=False):
|
||||||
if utils.compare_version('1.15', self._version) < 0:
|
if utils.compare_version('1.15', self._version) < 0:
|
||||||
raise errors.InvalidVersion('Exec is not supported in API < 1.15')
|
raise errors.InvalidVersion('Exec is not supported in API < 1.15')
|
||||||
|
if privileged and utils.compare_version('1.19', self._version) < 0:
|
||||||
|
raise errors.InvalidVersion(
|
||||||
|
'Privileged exec is not supported in API < 1.19'
|
||||||
|
)
|
||||||
if isinstance(container, dict):
|
if isinstance(container, dict):
|
||||||
container = container.get('Id')
|
container = container.get('Id')
|
||||||
if isinstance(cmd, six.string_types):
|
if isinstance(cmd, six.string_types):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue