Created
June 24, 2019 03:23
-
-
Save crossworth/3a293815e834bf362412439976d957a7 to your computer and use it in GitHub Desktop.
https://docs.docker.com/develop/sdk/examples/ http examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function dockerGet($endpoint) { | |
set_time_limit(0); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $endpoint); | |
curl_setopt($ch, CURLOPT_UNIX_SOCKET_PATH, '/var/run/docker.sock'); | |
curl_setopt($ch, CURLOPT_BUFFERSIZE, 256); | |
curl_setopt($ch, CURLOPT_TIMEOUT, 1000000); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
$result = curl_exec($ch); | |
curl_close($ch); | |
return $result; | |
} | |
var_dump(dockerGet("http:/v1.24/containers/json")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment