Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .jane-openapi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
return [
'directory' => 'src',
'namespace' => 'Docker\\API',
'openapi-file' => __DIR__ . '/openapi.yaml',
'openapi-file' => __DIR__ . '/openapi.json',
'strict' => false,
];
11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
},
"require": {
"php": ">=7.1",
"jane-php/open-api-runtime": "^7.0"
"jane-php/jane-php": "^7.0"
},
"require-dev": {
"phpunit/phpunit": "^10.4",
"friendsofphp/php-cs-fixer": "^2.9",
"jane-php/open-api-3": "^7.0",
"jane-php/json-schema": "^7.0",
"amphp/artax": "^3.0"
},
"suggest": {
Expand All @@ -28,5 +26,10 @@
}
},
"minimum-stability": "dev",
"prefer-stable": true
"prefer-stable": true,
"config": {
"allow-plugins": {
"php-http/discovery": false
}
}
}
15,431 changes: 15,431 additions & 0 deletions openapi.json

Large diffs are not rendered by default.

438 changes: 219 additions & 219 deletions src/Client.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Endpoint/BuildPrune.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ public function getAuthenticationScopes() : array
{
return array();
}
}
}
6 changes: 3 additions & 3 deletions src/Endpoint/ConfigCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
class ConfigCreate extends \Docker\API\Runtime\Client\BaseEndpoint implements \Docker\API\Runtime\Client\Endpoint
{
/**
*
*
* @param null|\Docker\API\Model\ConfigsCreatePostBody $requestBody
*
* @param null|\Docker\API\Model\ConfigsCreatePostBody $requestBody
*/
public function __construct(?\Docker\API\Model\ConfigsCreatePostBody $requestBody = null)
{
Expand Down Expand Up @@ -63,4 +63,4 @@ public function getAuthenticationScopes() : array
{
return array();
}
}
}
4 changes: 2 additions & 2 deletions src/Endpoint/ConfigDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ConfigDelete extends \Docker\API\Runtime\Client\BaseEndpoint implements \D
{
protected $id;
/**
*
*
*
* @param string $id ID of the config
*/
Expand Down Expand Up @@ -60,4 +60,4 @@ public function getAuthenticationScopes() : array
{
return array();
}
}
}
4 changes: 2 additions & 2 deletions src/Endpoint/ConfigInspect.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ConfigInspect extends \Docker\API\Runtime\Client\BaseEndpoint implements \
{
protected $id;
/**
*
*
*
* @param string $id ID of the config
*/
Expand Down Expand Up @@ -61,4 +61,4 @@ public function getAuthenticationScopes() : array
{
return array();
}
}
}
8 changes: 4 additions & 4 deletions src/Endpoint/ConfigList.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
class ConfigList extends \Docker\API\Runtime\Client\BaseEndpoint implements \Docker\API\Runtime\Client\Endpoint
{
/**
*
*
*
* @param array $queryParameters {
* @var string $filters A JSON encoded value of the filters (a `map[string][]string`) to process on the configs list. Available filters:

- `id=<config id>`
- `label=<key> or label=<key>=value`
- `name=<config name>`
- `names=<config name>`

* }
*/
public function __construct(array $queryParameters = array())
Expand Down Expand Up @@ -73,4 +73,4 @@ public function getAuthenticationScopes() : array
{
return array();
}
}
}
6 changes: 3 additions & 3 deletions src/Endpoint/ConfigUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ class ConfigUpdate extends \Docker\API\Runtime\Client\BaseEndpoint implements \D
protected $id;
protected $accept;
/**
*
*
*
* @param string $id The ID or name of the config
* @param null|\Docker\API\Model\ConfigSpec $requestBody
* @param null|\Docker\API\Model\ConfigSpec $requestBody
* @param array $queryParameters {
* @var int $version The version number of the config object being updated. This is required to avoid conflicting writes.
* }
Expand Down Expand Up @@ -91,4 +91,4 @@ public function getAuthenticationScopes() : array
{
return array();
}
}
}
2 changes: 1 addition & 1 deletion src/Endpoint/ContainerArchive.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ public function getAuthenticationScopes() : array
{
return array();
}
}
}
2 changes: 1 addition & 1 deletion src/Endpoint/ContainerArchiveInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ public function getAuthenticationScopes() : array
{
return array();
}
}
}
64 changes: 32 additions & 32 deletions src/Endpoint/ContainerAttach.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,91 +8,91 @@ class ContainerAttach extends \Docker\API\Runtime\Client\BaseEndpoint implements
protected $accept;
/**
* Attach to a container to read its output or send it input. You can attach to the same container multiple times and you can reattach to containers that have been detached.

Either the `stream` or `logs` parameter must be `true` for this endpoint to do anything.

See [the documentation for the `docker attach` command](https://docs.docker.com/engine/reference/commandline/attach/) for more details.

### Hijacking

This endpoint hijacks the HTTP connection to transport `stdin`, `stdout`, and `stderr` on the same socket.

This is the response from the daemon for an attach request:

```
HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream

[STREAM]
```

After the headers and two new lines, the TCP connection can now be used for raw, bidirectional communication between the client and server.

To hint potential proxies about connection hijacking, the Docker client can also optionally send connection upgrade headers.

For example, the client sends this request to upgrade the connection:

```
POST /containers/16253994b7c4/attach?stream=1&stdout=1 HTTP/1.1
Upgrade: tcp
Connection: Upgrade
```

The Docker daemon will respond with a `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]
```

### Stream format

When the TTY setting is disabled in [`POST /containers/create`](#operation/ContainerCreate), 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.

The header contains the information which the stream writes (`stdout` or `stderr`). It also contains the size of the associated frame encoded in the last four bytes (`uint32`).

It is encoded on the first eight bytes like this:

```go
header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
```

`STREAM_TYPE` can be:

- 0: `stdin` (is written on `stdout`)
- 1: `stdout`
- 2: `stderr`

`SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of the `uint32` size encoded as big endian.

Following the header is the payload, which is the specified number of bytes of `STREAM_TYPE`.

The simplest way to implement this protocol is the following:

1. Read 8 bytes.
2. Choose `stdout` or `stderr` depending on the first byte.
3. Extract the frame size from the last four bytes.
4. Read the extracted size and output it on the correct output.
5. Goto 1.

### Stream format when using a TTY

When the TTY setting is enabled in [`POST /containers/create`](#operation/ContainerCreate), 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`.

*
* @param string $id ID or name of the container
* @param array $queryParameters {
* @var string $detachKeys Override the key sequence for detaching a container.Format is a single character `[a-Z]` or `ctrl-<value>` where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
* @var bool $logs Replay previous logs from the container.

This is useful for attaching to a container that has started and you want to output everything since the container started.

If `stream` is also enabled, once all the previous output has been returned, it will seamlessly transition into streaming current output.

* @var bool $stream Stream attached streams from the time the request was made onwards
* @var bool $stdin Attach to `stdin`
* @var bool $stdout Attach to `stdout`
Expand Down Expand Up @@ -167,4 +167,4 @@ public function getAuthenticationScopes() : array
{
return array();
}
}
}
4 changes: 2 additions & 2 deletions src/Endpoint/ContainerAttachWebsocket.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ContainerAttachWebsocket extends \Docker\API\Runtime\Client\BaseEndpoint i
protected $id;
protected $accept;
/**
*
*
*
* @param string $id ID or name of the container
* @param array $queryParameters {
Expand Down Expand Up @@ -91,4 +91,4 @@ public function getAuthenticationScopes() : array
{
return array();
}
}
}
6 changes: 3 additions & 3 deletions src/Endpoint/ContainerChanges.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ class ContainerChanges extends \Docker\API\Runtime\Client\BaseEndpoint implement
/**
* Returns which files in a container's filesystem have been added, deleted,
or modified. The `Kind` of modification can be one of:

- `0`: Modified
- `1`: Added
- `2`: Deleted

*
* @param string $id ID or name of the container
*/
Expand Down Expand Up @@ -63,4 +63,4 @@ public function getAuthenticationScopes() : array
{
return array();
}
}
}
6 changes: 3 additions & 3 deletions src/Endpoint/ContainerCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
class ContainerCreate extends \Docker\API\Runtime\Client\BaseEndpoint implements \Docker\API\Runtime\Client\Endpoint
{
/**
*
*
* @param null|\Docker\API\Model\ContainersCreatePostBody $requestBody
*
* @param null|\Docker\API\Model\ContainersCreatePostBody $requestBody
* @param array $queryParameters {
* @var string $name Assign the specified name to the container. Must match `/?[a-zA-Z0-9_-]+`.
* }
Expand Down Expand Up @@ -83,4 +83,4 @@ public function getAuthenticationScopes() : array
{
return array();
}
}
}
4 changes: 2 additions & 2 deletions src/Endpoint/ContainerDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ContainerDelete extends \Docker\API\Runtime\Client\BaseEndpoint implements
protected $id;
protected $accept;
/**
*
*
*
* @param string $id ID or name of the container
* @param array $queryParameters {
Expand Down Expand Up @@ -87,4 +87,4 @@ public function getAuthenticationScopes() : array
{
return array();
}
}
}
4 changes: 2 additions & 2 deletions src/Endpoint/ContainerExec.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ContainerExec extends \Docker\API\Runtime\Client\BaseEndpoint implements \
* Run a command inside a running container.
*
* @param string $id ID or name of container
* @param null|\Docker\API\Model\ContainersIdExecPostBody $requestBody
* @param null|\Docker\API\Model\ContainersIdExecPostBody $requestBody
*/
public function __construct(string $id, ?\Docker\API\Model\ContainersIdExecPostBody $requestBody = null)
{
Expand Down Expand Up @@ -66,4 +66,4 @@ public function getAuthenticationScopes() : array
{
return array();
}
}
}
2 changes: 1 addition & 1 deletion src/Endpoint/ContainerExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ public function getAuthenticationScopes() : array
{
return array();
}
}
}
2 changes: 1 addition & 1 deletion src/Endpoint/ContainerInspect.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ public function getAuthenticationScopes() : array
{
return array();
}
}
}
2 changes: 1 addition & 1 deletion src/Endpoint/ContainerKill.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ public function getAuthenticationScopes() : array
{
return array();
}
}
}
Loading