From a7f99e7a8c00d929bde72fade7d01c1af3d349ee Mon Sep 17 00:00:00 2001 From: henrygd Date: Sat, 14 Mar 2026 15:26:44 -0400 Subject: [PATCH] agent: support new Docker API `Health` field (#1475) --- agent/docker.go | 8 ++++++++ internal/entities/container/container.go | 4 ++++ 2 files changed, 12 insertions(+) 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