my-container with an existing running container. Detach must be
false to consume attached output. Use the same Tty value when creating and
starting the exec command.
For non-TTY commands, stdout and stderr are separate. TTY commands combine both
streams on onStdout. Callbacks receive chunks that may contain partial lines.
To check the exit status after consuming the output, use
execInspect($exec->getId()) and inspect getRunning() and getExitCode().
Exit status is separate from HTTP success
Continue with the$exec created above, after $output->wait():
Detached execution
For a background command, setDetach to true on the start model. Do not
register callbacks or call wait() on its result; a detached start can return
null on success. Poll execInspect() with a bounded interval/deadline in
your application if you need completion and an exit code. This is a different
lifecycle from the attached example, not an asynchronous PHP promise.
TTY and upgraded connections
The attached wrapper handles HTTP 200 and HTTP 101 responses when their media type identifies Docker raw or multiplexed output. SetTty explicitly and
consistently at creation and start; do not try to autodetect it from the bytes.
A TTY combines stdout/stderr and may produce terminal control sequences.
Custom transports and proxies must preserve upgraded connections and provide
an unbuffered body. A normal buffered HTTP response adapter may pass list or
inspect calls but fail on exec output.
This recipe is output-only: it does not implement interactive stdin or a
terminal UI. onStdin() on DockerRawStream is not a write method. See
attach limitations.
Raw response bodies can contain binary frame headers. See
Container logs before working with raw fetch
modes.