diff --git a/agent/docker.go b/agent/docker.go index 1a04adf7..75d628a7 100644 --- a/agent/docker.go +++ b/agent/docker.go @@ -403,6 +403,14 @@ func (dm *dockerManager) updateContainerStats(ctr *container.ApiInfo, cacheTimeM stats.Id = ctr.IdShort statusText, health := parseDockerStatus(ctr.Status) + + // Use Health.Status if it's available (Docker API 1.52+; Podman TBD - https://github.com/containers/podman/issues/27786) + if ctr.Health.Status != "" { + if h, ok := container.DockerHealthStrings[ctr.Health.Status]; ok { + health = h + } + } + stats.Status = statusText stats.Health = health diff --git a/internal/entities/container/container.go b/internal/entities/container/container.go index a0d96c71..6c942085 100644 --- a/internal/entities/container/container.go +++ b/internal/entities/container/container.go @@ -10,6 +10,10 @@ type ApiInfo struct { Status string State string Image string + Health struct { + Status string + // FailingStreak int + } // ImageID string // Command string // Created int64