Exec

class aiodocker.execs.Exec(docker: Docker, id: str, tty: bool | None = None)[source]
property id: str
async inspect() dict[str, Any][source]
async resize(*, h: int | None = None, w: int | None = None) None[source]
start(*, timeout: float | ClientTimeout | Sentinel | None = SENTINEL, detach: Literal[False] = False) Stream[source]
start(*, timeout: float | ClientTimeout | Sentinel | None = SENTINEL, detach: Literal[True]) bytes

Start this exec instance.

Parameters:
  • timeout – The timeout for the exec operation (infinite by default).

  • detach – Indicates whether we should detach from the command (like the -d option to docker exec).

  • tty – Indicates whether a TTY should be allocated (like the -t option to docker exec).

Returns:

If detach is True, this method will return the result of the exec process as a binary string. If detach is False, an aiohttp.ClientWebSocketResponse will be returned. You can use it to send and receive data the same wa as the response of “ws_connect” of aiohttp. If tty is False, then the messages returned from receive* will have their extra attribute set to 1 if the data was from stdout or 2 if from stderr.