Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5d2a65b

Browse files
committed
Merge pull request docker-php#165 from sandaemc/1.22
Adjust options when DOCKER_TLS_VERIFY is enabled
2 parents 945f7fa + 6782b43 commit 5d2a65b

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/DockerClient.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,20 @@ public static function createFromEnv()
7272
$cafile = getenv('DOCKER_CERT_PATH').DIRECTORY_SEPARATOR.'ca.pem';
7373
$certfile = getenv('DOCKER_CERT_PATH').DIRECTORY_SEPARATOR.'cert.pem';
7474
$keyfile = getenv('DOCKER_CERT_PATH').DIRECTORY_SEPARATOR.'key.pem';
75-
$peername = getenv('DOCKER_PEER_NAME') ? getenv('DOCKER_PEER_NAME') : 'boot2docker';
7675

77-
$options['ssl'] = [
78-
'cafile' => $cafile,
79-
'local_cert' => $certfile,
80-
'local_pk' => $keyfile,
81-
'peer_name' => $peername,
76+
$stream_context = [
77+
'cafile' => $cafile,
78+
'local_cert' => $certfile,
79+
'local_pk' => $keyfile,
80+
];
81+
82+
if (getenv('DOCKER_PEER_NAME')) {
83+
$stream_context['peer_name'] = getenv('DOCKER_PEER_NAME');
84+
}
85+
86+
$options['ssl'] = true;
87+
$options['stream_context_options'] = [
88+
'ssl' => $stream_context
8289
];
8390
}
8491

0 commit comments

Comments
 (0)