Skip to content

Commit 3470968

Browse files
monperrusshin-
authored andcommitted
explain the socket parameter of exec_run
Signed-off-by: Martin Monperrus <[email protected]>
1 parent af00714 commit 3470968

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docker/models/containers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,16 @@ def exec_run(self, cmd, stdout=True, stderr=True, stdin=False, tty=False,
142142
detach (bool): If true, detach from the exec command.
143143
Default: False
144144
stream (bool): Stream response data. Default: False
145+
socket (bool): Whether to return a socket object or not. Default: False
145146
environment (dict or list): A dictionary or a list of strings in
146147
the following format ``["PASSWORD=xxx"]`` or
147148
``{"PASSWORD": "xxx"}``.
148149
149150
Returns:
150-
(generator or str): If ``stream=True``, a generator yielding
151-
response chunks. A string containing response data otherwise.
152-
151+
(generator or str):
152+
If ``stream=True``, a generator yielding response chunks.
153+
If ``socket=True``, a socket object of the connection (an SSL wrapped socket for TLS-based docker, on which one must call ``sendall`` and ``recv`` -- and **not** os.read / os.write).
154+
A string containing response data otherwise.
153155
Raises:
154156
:py:class:`docker.errors.APIError`
155157
If the server returns an error.

0 commit comments

Comments
 (0)