Created
October 22, 2019 11:57
-
-
Save nickfox-taterli/b086f04f7cc2c3c1293957f174ac1b79 to your computer and use it in GitHub Desktop.
Docker Cheat
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 | |
while (true) { | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "https://auth.docker.io/token?scope=repository:imdevops/hfish:pull&service=registry.docker.io"); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
$output = json_decode(curl_exec($ch), true); | |
curl_close($ch); | |
for ($t = 0; $t < 100; $t++) { | |
$conn = array(); | |
$mh = curl_multi_init(); | |
for ($i = 0; $i < 100; $i++) { | |
$conn[$i] = curl_init(); | |
curl_setopt($conn[$i], CURLOPT_URL, "https://registry-1.docker.io/v2/imdevops/hfish/manifests/latest"); | |
curl_setopt($conn[$i], CURLOPT_SSL_VERIFYPEER, false); | |
curl_setopt($conn[$i], CURLOPT_SSL_VERIFYHOST, false); | |
curl_setopt($conn[$i], CURLOPT_HTTPHEADER, array("Authorization:Bearer " . $output['token'], "Accept: application/vnd.docker.distribution.manifest.v2+json")); | |
curl_setopt($conn[$i], CURLOPT_RETURNTRANSFER, 1); | |
curl_multi_add_handle($mh, $conn[$i]); | |
} | |
$running = null; | |
do { | |
curl_multi_exec($mh, $running); | |
} while ($running > 0); | |
$output_result = null; | |
for ($i = 0; $i < 100; $i++) { | |
$output_result = curl_multi_getcontent($conn[$i]); | |
curl_multi_remove_handle($mh, $conn[$i]); | |
} | |
$output_result = json_decode($output_result, true); | |
if (!isset($output_result['config']['digest'])) { | |
break; | |
} | |
curl_multi_close($mh); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment