diff --git a/php/src/Container/WorkingState.php b/php/src/Container/WorkingState.php
index 3b4a24ccfc22..d6b3747aff19 100644
--- a/php/src/Container/WorkingState.php
+++ b/php/src/Container/WorkingState.php
@@ -9,4 +9,5 @@ enum WorkingState: string {
case Running = 'running';
case Starting = 'starting';
case Stopped = 'stopped';
+ case Unhealthy = 'unhealthy';
}
diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php
index d1d42a6b9140..b9bc50dcee08 100644
--- a/php/src/Docker/DockerActionManager.php
+++ b/php/src/Docker/DockerActionManager.php
@@ -62,10 +62,12 @@ public function GetContainerRunningState(Container $container) : WorkingState
$responseBody = json_decode((string)$response->getBody(), true);
- if ($responseBody['State']['Running'] === true) {
- return WorkingState::Running;
- } else {
+ if ($responseBody['State']['Running'] !== true) {
return WorkingState::Stopped;
+ } elseif(array_key_exists('Health', $responseBody['State']) && $responseBody['State']['Health']['Status'] !== 'healthy') {
+ return WorkingState::Unhealthy;
+ } else {
+ return WorkingState::Running;
}
}
@@ -133,12 +135,12 @@ public function GetContainerStartingState(Container $container) : WorkingState
$connection = @fsockopen($containerName, (int)$internalPort, $errno, $errstr, 0.2);
if ($connection) {
fclose($connection);
- return WorkingState::Running;
+ return $runningState;
} else {
return WorkingState::Starting;
}
} else {
- return WorkingState::Running;
+ return $runningState;
}
}
diff --git a/php/templates/containers.twig b/php/templates/containers.twig
index df6d5f4c47f5..fd1a27f06429 100644
--- a/php/templates/containers.twig
+++ b/php/templates/containers.twig
@@ -268,6 +268,13 @@
(docs)
{% endif %}
+ {% elseif container.GetRunningState().value == 'unhealthy' %}
+
+ {{ container.GetDisplayName() }} (Unhealthy)
+ {% if container.GetDocumentation() != '' %}
+ (docs)
+ {% endif %}
+
{% elseif container.GetRunningState().value == 'running' %}
{{ container.GetDisplayName() }} (Running)