parent
d1c90271be
commit
94cff08bc9
9 changed files with 111 additions and 26 deletions
@ -0,0 +1,9 @@ |
||||
<?php |
||||
exec("docker --version", $docker); |
||||
$res = Array("project" => "@PACKAGE_NAME@", |
||||
"version" => "@VERSION@", |
||||
"docker" => $docker, |
||||
"description" => "@DESCRIPTION_ENCODED@", |
||||
"readme" => "@README_ENCODED@"); |
||||
echo json_encode($res); |
||||
?> |
@ -0,0 +1,39 @@ |
||||
<?php |
||||
exec("docker images -aq", $res, $ret); |
||||
if ($ret!=0) { |
||||
echo 'digraph {'; |
||||
echo ' A [label="Error\nCannot get Docker Images"];'; |
||||
echo ' B [label="Does the Webserver have Docker rights?"];'; |
||||
echo ' A->B [label="Probable\nCause"];'; |
||||
echo '}'; |
||||
return; |
||||
} |
||||
exec("docker inspect ".join(" ", $res), $res2, $ret); |
||||
if ($ret==0) { |
||||
$images=json_decode(join($res2), true); |
||||
echo "digraph {\n"; |
||||
echo " rankdir=TB;\n"; |
||||
|
||||
foreach ($images as $i) { |
||||
$name = ""; |
||||
if (isset($i['RepoTags']) && count($i['RepoTags'])>0) { |
||||
$name = join("\\n", $i['RepoTags']); |
||||
if (isset($i['Author']) && $i['Author']!="") $name .= '\\n['.$i['Author'].']'; |
||||
} |
||||
echo ' "'.$i['Id'].'" [label="'.$name.'"];'."\n"; |
||||
} |
||||
|
||||
foreach ($images as $i) { |
||||
if (isset($i['Parent']) && $i['Parent']!="") |
||||
echo ' "'.$i['Parent'].'" -> "'.$i['Id'].'";'."\n"; |
||||
} |
||||
|
||||
echo "}"; |
||||
} else { |
||||
echo 'digraph {'; |
||||
echo ' A [label="Error\nCannot Inspect Docker Container"];'; |
||||
echo '}'; |
||||
return; |
||||
} |
||||
|
||||
?> |
Loading…
Reference in new issue