This repository was archived by the owner on Oct 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathClient.php
2215 lines (2000 loc) · 98.8 KB
/
Client.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
declare(strict_types=1);
/*
* This file has been auto generated by Jane,
*
* Do no edit it directly.
*/
namespace Docker\API;
class Client extends \Jane\OpenApiRuntime\Client\Psr7HttplugClient
{
/**
* Returns a list of containers. For details on the format, see [the inspect endpoint](#operation/ContainerInspect).
Note that it uses a different, smaller representation of a container than inspecting a single container. For example,
the list of linked containers is not propagated .
*
* @param array $queryParameters {
*
* @var bool $all Return all containers. By default, only running containers are shown
* @var int $limit return this number of most recently created containers, including non-running ones
* @var bool $size return the size of container as fields `SizeRw` and `SizeRootFs`
* @var string $filters Filters to process on the container list, encoded as JSON (a `map[string][]string`). For example, `{"status": ["paused"]}` will only return paused containers. Available filters:
* }
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerListBadRequestException
* @throws \Docker\API\Exception\ContainerListInternalServerErrorException
*
* @return null|\Docker\API\Model\ContainerSummaryItem[]|\Psr\Http\Message\ResponseInterface
*/
public function containerList(array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerList($queryParameters), $fetch);
}
/**
* @param \Docker\API\Model\ContainersCreatePostBody $body Container to create
* @param array $queryParameters {
*
* @var string $name Assign the specified name to the container. Must match `/?[a-zA-Z0-9_-]+`.
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerCreateBadRequestException
* @throws \Docker\API\Exception\ContainerCreateNotFoundException
* @throws \Docker\API\Exception\ContainerCreateConflictException
* @throws \Docker\API\Exception\ContainerCreateInternalServerErrorException
*
* @return null|\Docker\API\Model\ContainersCreatePostResponse201|\Psr\Http\Message\ResponseInterface
*/
public function containerCreate(\Docker\API\Model\ContainersCreatePostBody $body, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerCreate($body, $queryParameters), $fetch);
}
/**
* Return low-level information about a container.
*
* @param string $id ID or name of the container
* @param array $queryParameters {
*
* @var bool $size Return the size of container as fields `SizeRw` and `SizeRootFs`
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerInspectNotFoundException
* @throws \Docker\API\Exception\ContainerInspectInternalServerErrorException
*
* @return null|\Docker\API\Model\ContainersIdJsonGetResponse200|\Psr\Http\Message\ResponseInterface
*/
public function containerInspect(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerInspect($id, $queryParameters), $fetch);
}
/**
* On Unix systems, this is done by running the `ps` command. This endpoint is not supported on Windows.
*
* @param string $id ID or name of the container
* @param array $queryParameters {
*
* @var string $ps_args The arguments to pass to `ps`. For example, `aux`
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerTopNotFoundException
* @throws \Docker\API\Exception\ContainerTopInternalServerErrorException
*
* @return null|\Docker\API\Model\ContainersIdTopGetResponse200|\Psr\Http\Message\ResponseInterface
*/
public function containerTop(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerTop($id, $queryParameters), $fetch);
}
/**
* Get `stdout` and `stderr` logs from a container.
Note: This endpoint works only for containers with the `json-file` or `journald` logging driver.
*
* @param string $id ID or name of the container
* @param array $queryParameters {
*
* @var bool $follow return the logs as a stream
* @var bool $stdout Return logs from `stdout`
* @var bool $stderr Return logs from `stderr`
* @var int $since Only return logs since this time, as a UNIX timestamp
* @var int $until Only return logs before this time, as a UNIX timestamp
* @var bool $timestamps Add timestamps to every log line
* @var string $tail Only return this number of log lines from the end of the logs. Specify as an integer or `all` to output all log lines.
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerLogsNotFoundException
* @throws \Docker\API\Exception\ContainerLogsInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function containerLogs(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerLogs($id, $queryParameters), $fetch);
}
/**
* 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
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerChangesNotFoundException
* @throws \Docker\API\Exception\ContainerChangesInternalServerErrorException
*
* @return null|\Docker\API\Model\ContainersIdChangesGetResponse200Item[]|\Psr\Http\Message\ResponseInterface
*/
public function containerChanges(string $id, string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerChanges($id), $fetch);
}
/**
* Export the contents of a container as a tarball.
*
* @param string $id ID or name of the container
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerExportNotFoundException
* @throws \Docker\API\Exception\ContainerExportInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function containerExport(string $id, string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerExport($id), $fetch);
}
/**
* This endpoint returns a live stream of a container’s resource usage.
statistics.
The `precpu_stats` is the CPU statistic of last read, which is used
for calculating the CPU usage percentage. It is not the same as the
`cpu_stats` field.
If either `precpu_stats.online_cpus` or `cpu_stats.online_cpus` is
nil then for compatibility with older daemons the length of the
corresponding `cpu_usage.percpu_usage` array should be used.
*
* @param string $id ID or name of the container
* @param array $queryParameters {
*
* @var bool $stream Stream the output. If false, the stats will be output once and then it will disconnect.
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerStatsNotFoundException
* @throws \Docker\API\Exception\ContainerStatsInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function containerStats(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerStats($id, $queryParameters), $fetch);
}
/**
* Resize the TTY for a container. You must restart the container for the resize to take effect.
*
* @param string $id ID or name of the container
* @param array $queryParameters {
*
* @var int $h Height of the tty session in characters
* @var int $w Width of the tty session in characters
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerResizeNotFoundException
* @throws \Docker\API\Exception\ContainerResizeInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function containerResize(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerResize($id, $queryParameters), $fetch);
}
/**
* @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 `_`.
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerStartNotFoundException
* @throws \Docker\API\Exception\ContainerStartInternalServerErrorException
*
* @return null|\Docker\API\Model\ErrorResponse|\Psr\Http\Message\ResponseInterface
*/
public function containerStart(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerStart($id, $queryParameters), $fetch);
}
/**
* @param string $id ID or name of the container
* @param array $queryParameters {
*
* @var int $t Number of seconds to wait before killing the container
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerStopNotFoundException
* @throws \Docker\API\Exception\ContainerStopInternalServerErrorException
*
* @return null|\Docker\API\Model\ErrorResponse|\Psr\Http\Message\ResponseInterface
*/
public function containerStop(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerStop($id, $queryParameters), $fetch);
}
/**
* @param string $id ID or name of the container
* @param array $queryParameters {
*
* @var int $t Number of seconds to wait before killing the container
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerRestartNotFoundException
* @throws \Docker\API\Exception\ContainerRestartInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function containerRestart(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerRestart($id, $queryParameters), $fetch);
}
/**
* Send a POSIX signal to a container, defaulting to killing to the container.
*
* @param string $id ID or name of the container
* @param array $queryParameters {
*
* @var string $signal Signal to send to the container as an integer or string (e.g. `SIGINT`)
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerKillNotFoundException
* @throws \Docker\API\Exception\ContainerKillConflictException
* @throws \Docker\API\Exception\ContainerKillInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function containerKill(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerKill($id, $queryParameters), $fetch);
}
/**
* Change various configuration options of a container without having to recreate it.
*
* @param string $id ID or name of the container
* @param \Docker\API\Model\ContainersIdUpdatePostBody $update
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerUpdateNotFoundException
* @throws \Docker\API\Exception\ContainerUpdateInternalServerErrorException
*
* @return null|\Docker\API\Model\ContainersIdUpdatePostResponse200|\Psr\Http\Message\ResponseInterface
*/
public function containerUpdate(string $id, \Docker\API\Model\ContainersIdUpdatePostBody $update, string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerUpdate($id, $update), $fetch);
}
/**
* @param string $id ID or name of the container
* @param array $queryParameters {
*
* @var string $name New name for the container
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerRenameNotFoundException
* @throws \Docker\API\Exception\ContainerRenameConflictException
* @throws \Docker\API\Exception\ContainerRenameInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function containerRename(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerRename($id, $queryParameters), $fetch);
}
/**
* Use the cgroups freezer to suspend all processes in a container.
Traditionally, when suspending a process the `SIGSTOP` signal is used, which is observable by the process being suspended. With the cgroups freezer the process is unaware, and unable to capture, that it is being suspended, and subsequently resumed.
*
* @param string $id ID or name of the container
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerPauseNotFoundException
* @throws \Docker\API\Exception\ContainerPauseInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function containerPause(string $id, string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerPause($id), $fetch);
}
/**
* Resume a container which has been paused.
*
* @param string $id ID or name of the container
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerUnpauseNotFoundException
* @throws \Docker\API\Exception\ContainerUnpauseInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function containerUnpause(string $id, string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerUnpause($id), $fetch);
}
/**
* 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
* @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`
* @var bool $stderr Attach to `stderr`
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerAttachBadRequestException
* @throws \Docker\API\Exception\ContainerAttachNotFoundException
* @throws \Docker\API\Exception\ContainerAttachInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function containerAttach(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerAttach($id, $queryParameters), $fetch);
}
/**
* @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 Return logs
* @var bool $stream Return stream
* @var bool $stdin Attach to `stdin`
* @var bool $stdout Attach to `stdout`
* @var bool $stderr Attach to `stderr`
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerAttachWebsocketBadRequestException
* @throws \Docker\API\Exception\ContainerAttachWebsocketNotFoundException
* @throws \Docker\API\Exception\ContainerAttachWebsocketInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function containerAttachWebsocket(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerAttachWebsocket($id, $queryParameters), $fetch);
}
/**
* Block until a container stops, then returns the exit code.
*
* @param string $id ID or name of the container
* @param array $queryParameters {
*
* @var string $condition Wait until a container state reaches the given condition, either 'not-running' (default), 'next-exit', or 'removed'.
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerWaitNotFoundException
* @throws \Docker\API\Exception\ContainerWaitInternalServerErrorException
*
* @return null|\Docker\API\Model\ContainersIdWaitPostResponse200|\Psr\Http\Message\ResponseInterface
*/
public function containerWait(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerWait($id, $queryParameters), $fetch);
}
/**
* @param string $id ID or name of the container
* @param array $queryParameters {
*
* @var bool $v remove the volumes associated with the container
* @var bool $force if the container is running, kill it before removing it
* @var bool $link Remove the specified link associated with the container.
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerDeleteBadRequestException
* @throws \Docker\API\Exception\ContainerDeleteNotFoundException
* @throws \Docker\API\Exception\ContainerDeleteConflictException
* @throws \Docker\API\Exception\ContainerDeleteInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function containerDelete(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerDelete($id, $queryParameters), $fetch);
}
/**
* Get a tar archive of a resource in the filesystem of container id.
*
* @param string $id ID or name of the container
* @param array $queryParameters {
*
* @var string $path Resource in the container’s filesystem to archive.
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerArchiveBadRequestException
* @throws \Docker\API\Exception\ContainerArchiveNotFoundException
* @throws \Docker\API\Exception\ContainerArchiveInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function containerArchive(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerArchive($id, $queryParameters), $fetch);
}
/**
* A response header `X-Docker-Container-Path-Stat` is return containing a base64 - encoded JSON object with some filesystem header information about the path.
*
* @param string $id ID or name of the container
* @param array $queryParameters {
*
* @var string $path Resource in the container’s filesystem to archive.
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerArchiveInfoBadRequestException
* @throws \Docker\API\Exception\ContainerArchiveInfoNotFoundException
* @throws \Docker\API\Exception\ContainerArchiveInfoInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function containerArchiveInfo(string $id, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerArchiveInfo($id, $queryParameters), $fetch);
}
/**
* Upload a tar archive to be extracted to a path in the filesystem of container id.
*
* @param string $id ID or name of the container
* @param string $inputStream the input stream must be a tar archive compressed with one of the following algorithms: identity (no compression), gzip, bzip2, xz
* @param array $queryParameters {
*
* @var string $path Path to a directory in the container to extract the archive’s contents into.
* @var string $noOverwriteDirNonDir If “1”, “true”, or “True” then it will be an error if unpacking the given content would cause an existing directory to be replaced with a non-directory and vice versa.
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\PutContainerArchiveBadRequestException
* @throws \Docker\API\Exception\PutContainerArchiveForbiddenException
* @throws \Docker\API\Exception\PutContainerArchiveNotFoundException
* @throws \Docker\API\Exception\PutContainerArchiveInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function putContainerArchive(string $id, string $inputStream, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\PutContainerArchive($id, $inputStream, $queryParameters), $fetch);
}
/**
* @param array $queryParameters {
*
* @var string $filters filters to process on the prune list, encoded as JSON (a `map[string][]string`)
* }
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ContainerPruneInternalServerErrorException
*
* @return null|\Docker\API\Model\ContainersPrunePostResponse200|\Psr\Http\Message\ResponseInterface
*/
public function containerPrune(array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ContainerPrune($queryParameters), $fetch);
}
/**
* Returns a list of images on the server. Note that it uses a different, smaller representation of an image than inspecting a single image.
*
* @param array $queryParameters {
*
* @var bool $all Show all images. Only images from a final layer (no children) are shown by default.
* @var string $filters A JSON encoded value of the filters (a `map[string][]string`) to process on the images list. Available filters:
* @var bool $digests Show digest information as a `RepoDigests` field on each image.
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ImageListInternalServerErrorException
*
* @return null|\Docker\API\Model\ImageSummary[]|\Psr\Http\Message\ResponseInterface
*/
public function imageList(array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ImageList($queryParameters), $fetch);
}
/**
* Build an image from a tar archive with a `Dockerfile` in it.
The `Dockerfile` specifies how the image is built from the tar archive. It is typically in the archive's root, but can be at a different path or have a different name by specifying the `dockerfile` parameter. [See the `Dockerfile` reference for more information](https://docs.docker.com/engine/reference/builder/).
The Docker daemon performs a preliminary validation of the `Dockerfile` before starting the build, and returns an error if the syntax is incorrect. After that, each instruction is run one-by-one until the ID of the new image is output.
The build is canceled if the client drops the connection by quitting or being killed.
*
* @param string|resource|\Psr\Http\Message\StreamInterface $inputStream a tar archive compressed with one of the following algorithms: identity (no compression), gzip, bzip2, xz
* @param array $queryParameters {
*
* @var string $dockerfile Path within the build context to the `Dockerfile`. This is ignored if `remote` is specified and points to an external `Dockerfile`.
* @var string $t A name and optional tag to apply to the image in the `name:tag` format. If you omit the tag the default `latest` value is assumed. You can provide several `t` parameters.
* @var string $extrahosts Extra hosts to add to /etc/hosts
* @var string $remote A Git repository URI or HTTP/HTTPS context URI. If the URI points to a single text file, the file’s contents are placed into a file called `Dockerfile` and the image is built from that file. If the URI points to a tarball, the file is downloaded by the daemon and the contents therein used as the context for the build. If the URI points to a tarball and the `dockerfile` parameter is also specified, there must be a file with the corresponding path inside the tarball.
* @var bool $q suppress verbose build output
* @var bool $nocache do not use the cache when building the image
* @var string $cachefrom JSON array of images used for build cache resolution
* @var string $pull attempt to pull the image even if an older image exists locally
* @var bool $rm remove intermediate containers after a successful build
* @var bool $forcerm always remove intermediate containers, even upon failure
* @var int $memory set memory limit for build
* @var int $memswap Total memory (memory + swap). Set as `-1` to disable swap.
* @var int $cpushares CPU shares (relative weight)
* @var string $cpusetcpus CPUs in which to allow execution (e.g., `0-3`, `0,1`).
* @var int $cpuperiod the length of a CPU period in microseconds
* @var int $cpuquota microseconds of CPU time that the container can get in a CPU period
* @var string $buildargs JSON map of string pairs for build-time variables. Users pass these values at build-time. Docker uses the buildargs as the environment context for commands run via the `Dockerfile` RUN instruction, or for variable expansion in other `Dockerfile` instructions. This is not meant for passing secret values.
* @var int $shmsize Size of `/dev/shm` in bytes. The size must be greater than 0. If omitted the system uses 64MB.
* @var bool $squash Squash the resulting images layers into a single layer. *(Experimental release only.)*
* @var string $labels arbitrary key/value labels to set on the image, as a JSON map of string pairs
* @var string $networkmode Sets the networking mode for the run commands during build. Supported standard values are: `bridge`, `host`, `none`, and `container:<name|id>`. Any other value is taken as a custom network's name to which this container should connect to.
* @var string $platform Platform in the format os[/arch[/variant]]
* }
*
* @param array $headerParameters {
*
* @var string $Content-type
* @var string $X-Registry-Config This is a base64-encoded JSON object with auth configurations for multiple registries that a build may refer to
* }
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ImageBuildBadRequestException
* @throws \Docker\API\Exception\ImageBuildInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function imageBuild($inputStream, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ImageBuild($inputStream, $queryParameters, $headerParameters), $fetch);
}
/**
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\BuildPruneInternalServerErrorException
*
* @return null|\Docker\API\Model\BuildPrunePostResponse200|\Psr\Http\Message\ResponseInterface
*/
public function buildPrune(string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\BuildPrune(), $fetch);
}
/**
* Create an image by either pulling it from a registry or importing it.
*
* @param string $inputImage Image content if the value `-` has been specified in fromSrc query parameter
* @param array $queryParameters {
*
* @var string $fromImage Name of the image to pull. The name may include a tag or digest. This parameter may only be used when pulling an image. The pull is cancelled if the HTTP connection is closed.
* @var string $fromSrc Source to import. The value may be a URL from which the image can be retrieved or `-` to read the image from the request body. This parameter may only be used when importing an image.
* @var string $repo Repository name given to an image when it is imported. The repo may include a tag. This parameter may only be used when importing an image.
* @var string $tag Tag or digest. If empty when pulling an image, this causes all tags for the given image to be pulled.
* @var string $platform Platform in the format os[/arch[/variant]]
* }
*
* @param array $headerParameters {
*
* @var string $X-Registry-Auth A base64-encoded auth configuration. [See the authentication section for details.](#section/Authentication)
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ImageCreateNotFoundException
* @throws \Docker\API\Exception\ImageCreateInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function imageCreate(string $inputImage, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ImageCreate($inputImage, $queryParameters, $headerParameters), $fetch);
}
/**
* Return low-level information about an image.
*
* @param string $name Image name or id
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ImageInspectNotFoundException
* @throws \Docker\API\Exception\ImageInspectInternalServerErrorException
*
* @return null|\Docker\API\Model\Image|\Psr\Http\Message\ResponseInterface
*/
public function imageInspect(string $name, string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ImageInspect($name), $fetch);
}
/**
* Return parent layers of an image.
*
* @param string $name Image name or ID
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ImageHistoryNotFoundException
* @throws \Docker\API\Exception\ImageHistoryInternalServerErrorException
*
* @return null|\Docker\API\Model\ImagesNameHistoryGetResponse200Item[]|\Psr\Http\Message\ResponseInterface
*/
public function imageHistory(string $name, string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ImageHistory($name), $fetch);
}
/**
* Push an image to a registry.
If you wish to push an image on to a private registry, that image must already have a tag which references the registry. For example, `registry.example.com/myimage:latest`.
The push is cancelled if the HTTP connection is closed.
*
* @param string $name image name or ID
* @param array $queryParameters {
*
* @var string $tag The tag to associate with the image on the registry.
* }
*
* @param array $headerParameters {
*
* @var string $X-Registry-Auth A base64-encoded auth configuration. [See the authentication section for details.](#section/Authentication)
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ImagePushNotFoundException
* @throws \Docker\API\Exception\ImagePushInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function imagePush(string $name, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ImagePush($name, $queryParameters, $headerParameters), $fetch);
}
/**
* Tag an image so that it becomes part of a repository.
*
* @param string $name image name or ID to tag
* @param array $queryParameters {
*
* @var string $repo The repository to tag in. For example, `someuser/someimage`.
* @var string $tag The name of the new tag.
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ImageTagBadRequestException
* @throws \Docker\API\Exception\ImageTagNotFoundException
* @throws \Docker\API\Exception\ImageTagConflictException
* @throws \Docker\API\Exception\ImageTagInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function imageTag(string $name, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ImageTag($name, $queryParameters), $fetch);
}
/**
* Remove an image, along with any untagged parent images that were.
referenced by that image.
Images can't be removed if they have descendant images, are being
used by a running container or are being used by a build.
*
* @param string $name Image name or ID
* @param array $queryParameters {
*
* @var bool $force Remove the image even if it is being used by stopped containers or has other tags
* @var bool $noprune Do not delete untagged parent images
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ImageDeleteNotFoundException
* @throws \Docker\API\Exception\ImageDeleteConflictException
* @throws \Docker\API\Exception\ImageDeleteInternalServerErrorException
*
* @return null|\Docker\API\Model\ImageDeleteResponseItem[]|\Psr\Http\Message\ResponseInterface
*/
public function imageDelete(string $name, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ImageDelete($name, $queryParameters), $fetch);
}
/**
* Search for an image on Docker Hub.
*
* @param array $queryParameters {
*
* @var string $term Term to search
* @var int $limit Maximum number of results to return
* @var string $filters A JSON encoded value of the filters (a `map[string][]string`) to process on the images list. Available filters:
* }
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ImageSearchInternalServerErrorException
*
* @return null|\Docker\API\Model\ImagesSearchGetResponse200Item[]|\Psr\Http\Message\ResponseInterface
*/
public function imageSearch(array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ImageSearch($queryParameters), $fetch);
}
/**
* @param array $queryParameters {
*
* @var string $filters Filters to process on the prune list, encoded as JSON (a `map[string][]string`). Available filters:
- `dangling=<boolean>` When set to `true` (or `1`), prune only
unused *and* untagged images. When set to `false`
* }
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ImagePruneInternalServerErrorException
*
* @return null|\Docker\API\Model\ImagesPrunePostResponse200|\Psr\Http\Message\ResponseInterface
*/
public function imagePrune(array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ImagePrune($queryParameters), $fetch);
}
/**
* Validate credentials for a registry and, if available, get an identity token for accessing the registry without password.
*
* @param \Docker\API\Model\AuthConfig $authConfig Authentication to check
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\SystemAuthInternalServerErrorException
*
* @return null|\Docker\API\Model\AuthPostResponse200|\Psr\Http\Message\ResponseInterface
*/
public function systemAuth(\Docker\API\Model\AuthConfig $authConfig, string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\SystemAuth($authConfig), $fetch);
}
/**
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\SystemInfoInternalServerErrorException
*
* @return null|\Docker\API\Model\SystemInfo|\Psr\Http\Message\ResponseInterface
*/
public function systemInfo(string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\SystemInfo(), $fetch);
}
/**
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\SystemVersionInternalServerErrorException
*
* @return null|\Docker\API\Model\VersionGetResponse200|\Psr\Http\Message\ResponseInterface
*/
public function systemVersion(string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\SystemVersion(), $fetch);
}
/**
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\SystemPingInternalServerErrorException
*
* @return null|\Psr\Http\Message\ResponseInterface
*/
public function systemPing(string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\SystemPing(), $fetch);
}
/**
* @param \Docker\API\Model\ContainerConfig $containerConfig The container configuration
* @param array $queryParameters {
*
* @var string $container The ID or name of the container to commit
* @var string $repo Repository name for the created image
* @var string $tag Tag name for the create image
* @var string $comment Commit message
* @var string $author Author of the image (e.g., `John Hannibal Smith <[email protected]>`)
* @var bool $pause Whether to pause the container before committing
* @var string $changes `Dockerfile` instructions to apply while committing
* }
*
* @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
*
* @throws \Docker\API\Exception\ImageCommitNotFoundException
* @throws \Docker\API\Exception\ImageCommitInternalServerErrorException
*
* @return null|\Docker\API\Model\IdResponse|\Psr\Http\Message\ResponseInterface
*/
public function imageCommit(\Docker\API\Model\ContainerConfig $containerConfig, array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
{
return $this->executePsr7Endpoint(new \Docker\API\Endpoint\ImageCommit($containerConfig, $queryParameters), $fetch);
}
/**
* Stream real-time events from the server.
Various objects within Docker report events when something happens to them.
Containers report these events: `attach`, `commit`, `copy`, `create`, `destroy`, `detach`, `die`, `exec_create`, `exec_detach`, `exec_start`, `exec_die`, `export`, `health_status`, `kill`, `oom`, `pause`, `rename`, `resize`, `restart`, `start`, `stop`, `top`, `unpause`, and `update`
Images report these events: `delete`, `import`, `load`, `pull`, `push`, `save`, `tag`, and `untag`
Volumes report these events: `create`, `mount`, `unmount`, and `destroy`
Networks report these events: `create`, `connect`, `disconnect`, `destroy`, `update`, and `remove`
The Docker daemon reports these events: `reload`