Signed-off-by: Brian Goff <cpuguy83@gmail.com>
| ... | ... |
@@ -11,6 +11,26 @@ import ( |
| 11 | 11 |
// It returns a types.HijackedConnection with the hijacked connection |
| 12 | 12 |
// and the a reader to get output. It's up to the called to close |
| 13 | 13 |
// the hijacked connection by calling types.HijackedResponse.Close. |
| 14 |
+// |
|
| 15 |
+// The stream format on the response will be in one of two formats: |
|
| 16 |
+// |
|
| 17 |
+// If the container is using a TTY, there is only a single stream (stdout), and |
|
| 18 |
+// data is copied directly from the container output stream, no extra |
|
| 19 |
+// multiplexing or headers. |
|
| 20 |
+// |
|
| 21 |
+// If the container is *not* using a TTY, streams for stdout and stderr are |
|
| 22 |
+// multiplexed. |
|
| 23 |
+// The format of the multiplexed stream is as follows: |
|
| 24 |
+// |
|
| 25 |
+// [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}[]byte{OUTPUT}
|
|
| 26 |
+// |
|
| 27 |
+// STREAM_TYPE can be 1 for stdout and 2 for stderr |
|
| 28 |
+// |
|
| 29 |
+// SIZE1, SIZE2, SIZE3, and SIZE4 are four bytes of uint32 encoded as big endian. |
|
| 30 |
+// This is the size of OUTPUT. |
|
| 31 |
+// |
|
| 32 |
+// You can use github.com/docker/docker/pkg/stdcopy.StdCopy to demultiplex this |
|
| 33 |
+// stream. |
|
| 14 | 34 |
func (cli *Client) ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error) {
|
| 15 | 35 |
query := url.Values{}
|
| 16 | 36 |
if options.Stream {
|
| ... | ... |
@@ -13,6 +13,26 @@ import ( |
| 13 | 13 |
|
| 14 | 14 |
// ContainerLogs returns the logs generated by a container in an io.ReadCloser. |
| 15 | 15 |
// It's up to the caller to close the stream. |
| 16 |
+// |
|
| 17 |
+// The stream format on the response will be in one of two formats: |
|
| 18 |
+// |
|
| 19 |
+// If the container is using a TTY, there is only a single stream (stdout), and |
|
| 20 |
+// data is copied directly from the container output stream, no extra |
|
| 21 |
+// multiplexing or headers. |
|
| 22 |
+// |
|
| 23 |
+// If the container is *not* using a TTY, streams for stdout and stderr are |
|
| 24 |
+// multiplexed. |
|
| 25 |
+// The format of the multiplexed stream is as follows: |
|
| 26 |
+// |
|
| 27 |
+// [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}[]byte{OUTPUT}
|
|
| 28 |
+// |
|
| 29 |
+// STREAM_TYPE can be 1 for stdout and 2 for stderr |
|
| 30 |
+// |
|
| 31 |
+// SIZE1, SIZE2, SIZE3, and SIZE4 are four bytes of uint32 encoded as big endian. |
|
| 32 |
+// This is the size of OUTPUT. |
|
| 33 |
+// |
|
| 34 |
+// You can use github.com/docker/docker/pkg/stdcopy.StdCopy to demultiplex this |
|
| 35 |
+// stream. |
|
| 16 | 36 |
func (cli *Client) ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error) {
|
| 17 | 37 |
query := url.Values{}
|
| 18 | 38 |
if options.ShowStdout {
|