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

Skip to content
This repository was archived by the owner on Oct 26, 2019. It is now read-only.

Adjust options when DOCKER_TLS_VERIFY is enabled #165

Merged
merged 1 commit into from
Feb 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/DockerClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,20 @@ public static function createFromEnv()
$cafile = getenv('DOCKER_CERT_PATH').DIRECTORY_SEPARATOR.'ca.pem';
$certfile = getenv('DOCKER_CERT_PATH').DIRECTORY_SEPARATOR.'cert.pem';
$keyfile = getenv('DOCKER_CERT_PATH').DIRECTORY_SEPARATOR.'key.pem';
$peername = getenv('DOCKER_PEER_NAME') ? getenv('DOCKER_PEER_NAME') : 'boot2docker';

$options['ssl'] = [
'cafile' => $cafile,
'local_cert' => $certfile,
'local_pk' => $keyfile,
'peer_name' => $peername,
$stream_context = [
'cafile' => $cafile,
'local_cert' => $certfile,
'local_pk' => $keyfile,
];

if (getenv('DOCKER_PEER_NAME')) {
$stream_context['peer_name'] = getenv('DOCKER_PEER_NAME');
}

$options['ssl'] = true;
$options['stream_context_options'] = [
'ssl' => $stream_context
];
}

Expand Down