From 0219d41ba75c953c6fe5397cdd272f74b58068eb Mon Sep 17 00:00:00 2001 From: Rex Wang <109048808+RexWangPT@users.noreply.github.com> Date: Thu, 20 Oct 2022 15:10:39 +0800 Subject: [PATCH] fix(docker): Show stopped container on dashboard [EE-4327] (#7833) * EE-4327 fix(docker): Show stopped container on dashboard * Update ContainerStatus.tsx remove comment * EE-4327 fix(docker): show stopped container on dashboard --- api/docker/snapshot.go | 2 +- app/react/docker/DashboardView/ContainerStatus.tsx | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/api/docker/snapshot.go b/api/docker/snapshot.go index 2e9119259..a6136998a 100644 --- a/api/docker/snapshot.go +++ b/api/docker/snapshot.go @@ -159,7 +159,7 @@ func snapshotContainers(snapshot *portainer.DockerSnapshot, cli *client.Client) gpuUseSet := make(map[string]struct{}) gpuUseAll := false for _, container := range containers { - if container.State == "exited" { + if container.State == "exited" || container.State == "stopped" { stoppedContainers++ } else if container.State == "running" { runningContainers++ diff --git a/app/react/docker/DashboardView/ContainerStatus.tsx b/app/react/docker/DashboardView/ContainerStatus.tsx index d16387fbe..1b53b5204 100644 --- a/app/react/docker/DashboardView/ContainerStatus.tsx +++ b/app/react/docker/DashboardView/ContainerStatus.tsx @@ -60,7 +60,10 @@ function runningContainersFilter(containers: DockerContainer[]) { .length; } function stoppedContainersFilter(containers: DockerContainer[]) { - return containers.filter((container) => container.Status === 'exited').length; + return containers.filter( + (container) => + container.Status === 'exited' || container.Status === 'stopped' + ).length; } function healthyContainersFilter(containers: DockerContainer[]) { return containers.filter((container) => container.Status === 'healthy')