stream
or logs
parameter must be true
for this endpoint to do anything.docker attach
command for more details.stdin
, stdout
, and stderr
on the same socket.HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream
[STREAM]
POST /containers/16253994b7c4/attach?stream=1&stdout=1 HTTP/1.1
Upgrade: tcp
Connection: Upgrade
101 UPGRADED
response, and will similarly follow with the raw stream:HTTP/1.1 101 UPGRADED
Content-Type: application/vnd.docker.raw-stream
Connection: Upgrade
Upgrade: tcp
[STREAM]
POST /containers/create
, the stream over the hijacked connected is multiplexed to separate out stdout
and stderr
. The stream consists of a series of frames, each containing a header and a payload.stdout
or stderr
). It also contains the size of the associated frame encoded in the last four bytes (uint32
).
STREAM_TYPE
can be:stdin
(is written on stdout
)stdout
stderr
SIZE1, SIZE2, SIZE3, SIZE4
are the four bytes of the uint32
size encoded as big endian.STREAM_TYPE
.stdout
or stderr
depending on the first byte.POST /containers/create
, the stream is not multiplexed. The data exchanged over the hijacked connection is simply the raw data from the process PTY and client's stdin
.curl --location --request POST '/v1.33/containers//attach'
{}