@@ -11,7 +11,7 @@ This library aims to reach 100% API support of the Docker Engine. |
11 | 11 |
|
12 | 12 | ## Documentation |
13 | 13 |
|
14 | | -The [version 3.x documentation](https://docker-php.mintlify.site/) is available. |
| 14 | +The [version 4.x documentation](https://docker-php.mintlify.site/) is available. |
15 | 15 | Its source lives in |
16 | 16 | [docs/](docs/); see [DOCUMENTATION.md](DOCUMENTATION.md) to preview and edit it |
17 | 17 | locally. The [legacy documentation](https://docker-php.readthedocs.io/en/latest/) |
@@ -28,25 +28,24 @@ maintenance of the original `docker-php/docker-php` repository to give you a |
28 | 28 | better upgrade path. Development will continue here, and we will archive |
29 | 29 | `beluga-php/docker-php` once the migration is complete. |
30 | 30 |
|
31 | | -Version 3.0 targets Docker Engine API v1.45. We plan |
32 | | -to add the missing API versions and bring support up to the latest Docker Engine |
33 | | -API. See [Upgrading to 3.0](#upgrading-to-30) below for how to migrate from |
34 | | -existing releases. |
| 31 | +Version 4.0 works with Docker Engine API v1.45 to v1.56. See |
| 32 | +[Upgrading to 4.0](#upgrading-to-40) below for how to migrate from existing |
| 33 | +releases. |
35 | 34 |
|
36 | 35 | ## Requirements |
37 | 36 |
|
38 | 37 | - PHP 8.1 or later, with the `mbstring` extension. |
39 | 38 | - [Composer](https://getcomposer.org/). |
40 | | -- Access to a Docker daemon that accepts API v1.45 requests. |
| 39 | +- Access to a Docker daemon with API v1.45 or later (Docker Engine 26.0 or later). |
41 | 40 |
|
42 | 41 | ## Installation |
43 | 42 |
|
44 | 43 | ```bash |
45 | | -composer require "docker-php/docker-php:^3.0" |
| 44 | +composer require "docker-php/docker-php:^4.0" |
46 | 45 | ``` |
47 | 46 |
|
48 | | -Composer installs `docker-php/docker-php-api` as a dependency. The 3.0 release |
49 | | -targets Docker API v1.45 and requires the matching generated API package. |
| 47 | +Composer also installs `docker-php/docker-php-api`, choosing the newest API line |
| 48 | +unless you require one. See [Docker API versions](#docker-api-versions). |
50 | 49 |
|
51 | 50 | ## Usage |
52 | 51 |
|
@@ -79,58 +78,64 @@ These guides cover callback streams, TTY output and raw response framing. |
79 | 78 |
|
80 | 79 | ## Docker API versions |
81 | 80 |
|
82 | | -See the official [Docker Engine API v1.45 reference](https://docs.docker.com/reference/api/engine/version/v1.45/) |
83 | | -for endpoint descriptions, parameters and response schemas matching this API line. |
| 81 | +Each Docker Engine API version has its own `docker-php/docker-php-api` line with |
| 82 | +generated endpoints and models. The line uses the four-part version |
| 83 | +`Jane-major.Docker-major.Docker-minor.revision`: `7.1.56.0` means Docker API 1.56, |
| 84 | +generated with Jane 7, revision 0. To use a specific version, require its line: |
84 | 85 |
|
85 | | -The client package follows semantic versioning. The generated API package uses |
86 | | -`Jane-major.Docker-major.Docker-minor.revision`: `7.1.45.0` means Docker API 1.45, |
87 | | -generated with Jane 7, revision 0. |
88 | | - |
89 | | -Keep generated API dependencies within one Docker specification. The |
90 | | -3.0 client uses this range: |
91 | | - |
92 | | -```json |
93 | | -"docker-php/docker-php-api": ">=7.1.45.0 <7.1.46.0" |
| 86 | +```bash |
| 87 | +composer require "docker-php/docker-php:^4.0" "docker-php/docker-php-api:>=7.1.51.0 <7.1.52.0" |
94 | 88 | ``` |
95 | 89 |
|
96 | | -With the default connection factory, `DOCKER_API_VERSION` overrides the version |
97 | | -in request URLs: |
| 90 | +Pin a line if your code names generated models or calls methods that differ |
| 91 | +between versions. See the official |
| 92 | +[Docker Engine API reference](https://docs.docker.com/reference/api/engine/) for |
| 93 | +each version's endpoints, parameters and response schemas. |
98 | 94 |
|
99 | | -```bash |
100 | | -DOCKER_API_VERSION=1.52 php your-script.php |
101 | | -``` |
| 95 | +The bundled connection factory negotiates the version in request URLs: it uses |
| 96 | +the lower of the installed line and the daemon's maximum API version, as the |
| 97 | +Docker CLI does. `DOCKER_API_VERSION` or the factory's `api_version` option fix |
| 98 | +the version instead. Changing the URL version does not change the generated |
| 99 | +models. See [API versions](https://docker-php.mintlify.site/api-versions). |
| 100 | + |
| 101 | +## Upgrading to 4.0 |
102 | 102 |
|
103 | | -Since 3.1.0, the factory's `api_version` option can pin the request version |
104 | | -directly in PHP. It takes precedence over `DOCKER_API_VERSION`. See |
105 | | -[connection settings](https://docker-php.mintlify.site/connection#factory-options). |
| 103 | +### From docker-php 3.x |
106 | 104 |
|
107 | | -The generated endpoints and models still describe API v1.45. Changing the URL |
108 | | -version does not add newer API fields or endpoints. The client does not |
109 | | -automatically negotiate an API version with the daemon. |
| 105 | +- Composer now installs the newest API line unless you require one. Require |
| 106 | + `docker-php/docker-php-api:>=7.1.45.0 <7.1.46.0` to keep the 3.x models. |
| 107 | +- Requests negotiate the API version with the daemon unless you set one. |
| 108 | +- Error statuses the generated endpoints do not handle throw an |
| 109 | + `UnexpectedStatusCodeException`. Call `throwOnUnexpectedStatus(false)` to |
| 110 | + return `null` instead. |
| 111 | +- `Context` applies `.dockerignore`. Call `applyDockerignore(false)` to archive |
| 112 | + the whole directory. |
110 | 113 |
|
111 | | -## Upgrading to 3.0 |
| 114 | +Applications that cannot upgrade yet can stay on `^3.3`. See the |
| 115 | +[upgrade guide](https://docker-php.mintlify.site/migration#from-3-x) for model |
| 116 | +changes between API versions. |
112 | 117 |
|
113 | 118 | ### From docker-php 2.x |
114 | 119 |
|
115 | | -Version 3.0 requires PHP 8.1 or later, PSR-7 v2 and Jane 7-generated models. |
| 120 | +Version 4.0 requires PHP 8.1 or later, PSR-7 v2 and Jane 7-generated models. |
116 | 121 | Review endpoint signatures, model types and HTTP client dependencies before |
117 | 122 | upgrading. Check log and exec consumers against the |
118 | 123 | [streaming documentation](https://docker-php.mintlify.site/reference/streams). |
119 | 124 |
|
120 | | -Change the client requirement to `docker-php/docker-php:^3.0`. Remove an explicit |
121 | | -`docker-php/docker-php-api:4.1.*` requirement, or change it to the API 1.45 range |
| 125 | +Change the client requirement to `docker-php/docker-php:^4.0`. Remove an explicit |
| 126 | +`docker-php/docker-php-api:4.1.*` requirement, or change it to one API line as |
122 | 127 | shown above. Update dependencies, test your application and commit its updated |
123 | 128 | `composer.lock`. |
124 | 129 |
|
125 | 130 | ### From beluga-php |
126 | 131 |
|
127 | | -Version 3.0 continues the client maintained under `beluga-php/docker-php`. |
| 132 | +Version 4.0 continues the client maintained under `beluga-php/docker-php`. |
128 | 133 | The PHP namespaces remain `Docker` and `Docker\API`. |
129 | 134 |
|
130 | 135 | Remove the `beluga-php/docker-php` requirement and any explicit |
131 | 136 | `beluga-php/docker-php-api` requirement from `composer.json`. Add |
132 | | -`docker-php/docker-php:^3.0`; add the API 1.45 range above if your application |
133 | | -requires the generated API package directly. Resolve the package changes |
| 137 | +`docker-php/docker-php:^4.0`; to keep the Beluga v1.45 models, also require |
| 138 | +`docker-php/docker-php-api:>=7.1.45.0 <7.1.46.0`. Resolve the package changes |
134 | 139 | together, then test the application and commit its updated `composer.lock`. |
135 | 140 |
|
136 | 141 | Install one package family at a time: the Beluga and original packages contain |
|