forked from docker-php/docker-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerClient.php
More file actions
30 lines (24 loc) · 853 Bytes
/
Copy pathDockerClient.php
File metadata and controls
30 lines (24 loc) · 853 Bytes
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
<?php
namespace Docker\Http;
use Docker\Http\Adapter\DockerAdapter;
use GuzzleHttp\Client;
use GuzzleHttp\Message\MessageFactory;
class DockerClient extends Client
{
public function __construct(array $config = [], $entrypoint = null)
{
if (null === $entrypoint) {
$entrypoint = getenv('DOCKER_HOST') ? getenv('DOCKER_HOST') : 'unix:///var/run/docker.sock';
}
if (!isset($config['adapter'])) {
if (isset($config['message_factory'])) {
$messageFactory = $config['message_factory'];
} else {
$messageFactory = new MessageFactory();
}
$config['message_factory'] = $messageFactory;
$config['adapter'] = new DockerAdapter($messageFactory, $entrypoint);
}
parent::__construct($config);
}
}