You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+126Lines changed: 126 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,8 @@ The `Client` is responsible for assembling and sending HTTP requests to the Dock
73
73
It requires a `Browser` object bound to the main `EventLoop` in order to handle async requests and a base URL.
74
74
The recommended way to create a `Client` is using the `Factory` (see above).
75
75
76
+
#### Commands
77
+
76
78
All public methods on the `Client` resemble the API described in the [Remote API documentation](https://docs.docker.com/reference/api/docker_remote_api_v1.15/) like this:
77
79
78
80
```php
@@ -92,6 +94,8 @@ $client->version();
92
94
93
95
Listing all available commands is out of scope here, please refer to the [Remote API documentation](https://docs.docker.com/reference/api/docker_remote_api_v1.15/) or the class outline.
94
96
97
+
#### Promises
98
+
95
99
Sending requests is async (non-blocking), so you can actually send multiple requests in parallel.
96
100
Docker will respond to each request with a response message, the order is not guaranteed.
97
101
Sending requests uses a [Promise](https://github.com/reactphp/promise)-based interface that makes it easy to react to when a request is fulfilled (i.e. either successfully resolved or rejected with an error):
@@ -107,6 +111,128 @@ $client->version()->then(
107
111
});
108
112
```
109
113
114
+
#### TAR streaming
115
+
116
+
The following API endpoints resolve with a string in the [TAR file format](https://en.wikipedia.org/wiki/Tar_%28computing%29):
117
+
118
+
```php
119
+
$client->containerExport($container);
120
+
$client->containerCopy($container, $config);
121
+
```
122
+
123
+
Keep in mind that this means the whole string has to be kept in memory.
124
+
This is easy to get started and works reasonably well for smaller files/containers.
125
+
126
+
For bigger containers it's usually a better idea to use a streaming approach,
127
+
where only small chunks have to be kept in memory.
128
+
This works for (any number of) files of arbitrary sizes.
129
+
The following API endpoints complement the default Promise-based API and return
130
+
a [`Stream`](https://github.com/reactphp/stream) instance instead:
0 commit comments