-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathresize.php
More file actions
22 lines (15 loc) · 713 Bytes
/
resize.php
File metadata and controls
22 lines (15 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
// this example tries to adjust the TTY size of the given container to 10x10.
// you can check this via "docker logs".
require __DIR__ . '/../vendor/autoload.php';
$container = isset($argv[1]) ? $argv[1] : 'asd';
$client = new Clue\React\Docker\Client();
$client->containerInspect($container)->then(function ($info) use ($client, $container) {
$size = $info['HostConfig']['ConsoleSize'];
echo 'Current TTY size is ' . $size[0] . 'x' . $size[1] . PHP_EOL;
return $client->containerResize($container, $size[0] + 10, $size[1] + 10);
})->then(function () use ($client) {
echo 'Successfully set' . PHP_EOL;
}, function (Exception $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
});