diff --git a/data/web/debug.php b/data/web/debug.php
index ea9672b8..35511898 100644
--- a/data/web/debug.php
+++ b/data/web/debug.php
@@ -83,14 +83,15 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
'netfilter-mailcow',
'clamd-mailcow'
);
+ $container_states = (docker($container, 'states'));
foreach ($container_array as $container) {
- $container_stats = docker($container, 'info');
+ $container_state = $container_states[$container];
?>
+
diff --git a/data/web/inc/functions.docker.inc.php b/data/web/inc/functions.docker.inc.php
index c8401da6..a0705cff 100644
--- a/data/web/inc/functions.docker.inc.php
+++ b/data/web/inc/functions.docker.inc.php
@@ -26,6 +26,28 @@ function docker($service_name, $action, $attr1 = null, $attr2 = null, $extra_hea
}
}
return false;
+ case 'states':
+ curl_setopt($curl, CURLOPT_URL, 'http://dockerapi:8080/containers/json');
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($curl, CURLOPT_POST, 0);
+ curl_setopt($curl, CURLOPT_TIMEOUT, 10);
+ $response = curl_exec($curl);
+ if ($response === false) {
+ $err = curl_error($curl);
+ curl_close($curl);
+ return $err;
+ }
+ else {
+ curl_close($curl);
+ $containers = json_decode($response, true);
+ if (!empty($containers)) {
+ foreach ($containers as $container) {
+ $out[$container['Config']['Labels']['com.docker.compose.service']] = $container['State'];
+ }
+ }
+ return (!empty($out)) ? $out : false;
+ }
+ return false;
break;
case 'info':
$container_id = docker($service_name, 'get_id');