Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
fix(docker): treat all local RepoDigests as the current image
pulse-triage[bot]40fff0636dcc
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex b0acd1ed24..7d4e4819c2 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -8080,3 +8080,13 @@ repeats before the metrics batch is enqueued, reducing WAL churn withoutchanging host admission, token binding or removal-block behaviour. Focused prooflives in `internal/monitoring/monitor_host_agents_test.go`(`TestDedupeUnifiedMetricWritesDropsExactReplays`).++### Docker update preflight accepts any local RepoDigest for the planned image++The typed container-update preflight resolves the container image's full+RepoDigest set and admits the planned digest when it matches any entry rather+than only the first. A correctly planned update therefore stays actionable when+the local image carries more than one valid RepoDigest. The shared resolution+path is covered by `TestAgent_getImageRepoDigests_MultipleDigestsForOneImage`+and `TestRegistryChecker_MultipleLocalRepoDigestsSuppressFalseUpdate`; this is+source-level proof, not installed acceptance.diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.mdindex 9790120617..604cc1207f 100644--- a/docs/release-control/v6/internal/subsystems/monitoring.md+++ b/docs/release-control/v6/internal/subsystems/monitoring.md@@ -4080,3 +4080,14 @@ real change is never masked. The guard is bounded so a long-lived monitor withchurning resource IDs cannot pin memory. Focused proof lives in`internal/monitoring/monitor_host_agents_test.go`(`TestDedupeUnifiedMetricWritesDropsExactReplays`).++### Docker image update comparison accepts every local RepoDigest++Docker records every RepoDigest an image is known by, and the digest for a+tag's manifest is not always the first entry. Update detection now compares the+whole local RepoDigest set against the registry's resolved and index digests,+so a current image whose manifest appears under a later RepoDigest is not+reported as outdated. `TestRegistryChecker_MultipleLocalRepoDigestsSuppressFalseUpdate`,+`TestAgent_getImageRepoDigests_MultipleDigestsForOneImage` and the multi-digest+`TestRegistryChecker_DigestsDiffer` cases pin the comparison. This is synthetic+registry-transport evidence, not reporter acceptance.diff --git a/internal/dockeragent/agent_collect_test.go b/internal/dockeragent/agent_collect_test.goindex dd156afa3b..74b2f553f4 100644--- a/internal/dockeragent/agent_collect_test.go+++ b/internal/dockeragent/agent_collect_test.go@@ -802,3 +802,29 @@ func TestAgentClose(t *testing.T) {t.Fatal("expected docker Close to be called")}}++func TestAgentCollectImageRepoDigestsIncludesEveryLocalDigest(t *testing.T) {+ agent := &Agent{+ docker: &fakeDockerClient{+ imageInspectWithRawFn: func(context.Context, string) (imagetypes.InspectResponse, []byte, error) {+ return imagetypes.InspectResponse{+ RepoDigests: []string{+ "docker.io/library/postgres@sha256:44c4",+ "docker.io/library/postgres@sha256:cf78",+ },+ Architecture: "amd64",+ Os: "linux",+ }, nil, nil+ },+ },+ logger: zerolog.New(io.Discard),+ }++ digests, arch, os, _ := agent.getImageRepoDigests(context.Background(), "image-id", "postgres:16.15-alpine3.24")+ if len(digests) != 2 || digests[0] != "sha256:44c4" || digests[1] != "sha256:cf78" {+ t.Fatalf("digests = %v, want both local RepoDigests", digests)+ }+ if arch != "amd64" || os != "linux" {+ t.Fatalf("platform = %q/%q, want amd64/linux", arch, os)+ }+}diff --git a/internal/dockeragent/collect.go b/internal/dockeragent/collect.goindex d2e0356f6a..28c8b92874 100644--- a/internal/dockeragent/collect.go+++ b/internal/dockeragent/collect.go@@ -775,7 +775,11 @@ func (a *Agent) collectContainer(ctx context.Context, summary containertypes.Sum// Get the actual manifest digest (RepoDigest) from the image for accurate comparison.// The ImageID is a local content-addressable ID that differs from the registry manifest digest.// We also get the architecture details to correctly resolve manifest lists from the registry.- digestForComparison, arch, os, variant := a.getImageRepoDigest(containerCtx, summary.ImageID, summary.Image)+ currentDigests, arch, os, variant := a.getImageRepoDigests(containerCtx, summary.ImageID, summary.Image)+ digestForComparison := ""+ if len(currentDigests) > 0 {+ digestForComparison = currentDigests[0]+ }var imageToCheck string// Always prefer the image name from inspect config as it's the authoritative source@@ -808,7 +812,11 @@ func (a *Agent) collectContainer(ctx context.Context, summary containertypes.SumStr("variant", variant).Msg("Checking update for container")- result := a.registryChecker.CheckImageUpdate(ctx, imageToCheck, digestForComparison, arch, os, variant)+ // Pass the whole local digest set. Docker records every RepoDigest+ // the image is known by, and a tag's manifest digest is often not+ // the first entry, so comparing only one digest reports a current+ // image as outdated (#2110).+ result := a.registryChecker.CheckImageUpdate(ctx, imageToCheck, strings.Join(currentDigests, ","), arch, os, variant)if result != nil {container.UpdateStatus = &agentsdocker.UpdateStatus{UpdateAvailable: result.UpdateAvailable,@@ -956,6 +964,20 @@ func extractHealthcheckTargets(test []string) []string {// getImageRepoDigest retrieves the RepoDigest for an image and its platform details.// It returns the digest, architecture, OS, and variant.func (a *Agent) getImageRepoDigest(ctx context.Context, imageID, imageName string) (string, string, string, string) {+ digests, arch, os, variant := a.getImageRepoDigests(ctx, imageID, imageName)+ if len(digests) == 0 {+ return "", arch, os, variant+ }+ return digests[0], arch, os, variant+}++// getImageRepoDigests returns every manifest digest the local image is known+// by, with digests whose repository matches the requested image reference+// first, plus the platform details. A single image can carry several+// RepoDigests when it was pulled under more than one reference (for example a+// tag and a platform manifest), so an update check must treat the whole set as+// the local identity rather than trusting one arbitrary entry (#2110).+func (a *Agent) getImageRepoDigests(ctx context.Context, imageID, imageName string) ([]string, string, string, string) {imageInspect, _, err := a.docker.ImageInspectWithRaw(ctx, imageID)if err != nil {a.logger.Debug().@@ -963,7 +985,7 @@ func (a *Agent) getImageRepoDigest(ctx context.Context, imageID, imageName strinStr("imageID", imageID).Str("imageName", imageName).Msg("Failed to inspect image for RepoDigest")- return "", "", "", ""+ return nil, "", "", ""}arch := imageInspect.Architecture@@ -972,32 +994,29 @@ func (a *Agent) getImageRepoDigest(ctx context.Context, imageID, imageName strinif len(imageInspect.RepoDigests) == 0 {// Locally built images won't have RepoDigests- return "", arch, os, variant+ return nil, arch, os, variant}- // Try to find a RepoDigest that matches the image reference+ matched := make([]string, 0, len(imageInspect.RepoDigests))+ unmatched := make([]string, 0, len(imageInspect.RepoDigests))// RepoDigests format: "registry/repo@sha256:..."for _, repoDigest := range imageInspect.RepoDigests {- // Extract just the digest part (after @)- if idx := strings.LastIndex(repoDigest, "@"); idx >= 0 {- repoRef := repoDigest[:idx] // e.g., "docker.io/library/nginx"- digest := repoDigest[idx+1:] // e.g., "sha256:abc..."-- // Check if this RepoDigest matches our image reference- // Normalize both for comparison- if matchesImageReference(imageName, repoRef) {- return digest, arch, os, variant- }+ idx := strings.LastIndex(repoDigest, "@")+ if idx < 0 {+ continue+ }+ digest := strings.TrimSpace(repoDigest[idx+1:])+ if digest == "" {+ continue+ }+ if matchesImageReference(imageName, repoDigest[:idx]) {+ matched = append(matched, digest)+ } else {+ unmatched = append(unmatched, digest)}}- // If no exact match, return the first RepoDigest's digest- // This handles cases where the image was pulled with a different tag- if idx := strings.LastIndex(imageInspect.RepoDigests[0], "@"); idx >= 0 {- return imageInspect.RepoDigests[0][idx+1:], arch, os, variant- }-- return "", arch, os, variant+ return append(matched, unmatched...), arch, os, variant}func addrString(addr netip.Addr) string {diff --git a/internal/dockeragent/container_update_typed.go b/internal/dockeragent/container_update_typed.goindex b67f331f50..9d727f12bb 100644--- a/internal/dockeragent/container_update_typed.go+++ b/internal/dockeragent/container_update_typed.go@@ -63,9 +63,24 @@ func (a *Agent) TypedContainerUpdatePreflight(ctx context.Context, runtime, contif inspect.Config != nil {imageName = inspect.Config.Image}- repoDigest, _, _, _ = a.getImageRepoDigest(ctx, localImageID, imageName)- repoDigest = strings.TrimSpace(repoDigest)- matchesRepoDigest = strings.EqualFold(repoDigest, expectedImageDigest)+ // An image can carry several RepoDigests (#2110), so accept the+ // planned digest when it matches any of them rather than only the+ // first entry.+ repoDigests, _, _, _ := a.getImageRepoDigests(ctx, localImageID, imageName)+ for _, candidate := range repoDigests {+ candidate = strings.TrimSpace(candidate)+ if candidate == "" {+ continue+ }+ if repoDigest == "" {+ repoDigest = candidate+ }+ if strings.EqualFold(candidate, expectedImageDigest) {+ repoDigest = candidate+ matchesRepoDigest = true+ break+ }+ }}if !matchesLocalID && !matchesRepoDigest {if repoDigest == "" {diff --git a/internal/dockeragent/container_update_typed_test.go b/internal/dockeragent/container_update_typed_test.goindex 646bed64e6..a25b94be31 100644--- a/internal/dockeragent/container_update_typed_test.go+++ b/internal/dockeragent/container_update_typed_test.go@@ -125,3 +125,29 @@ func TestTypedContainerUpdateDelegatesToProductionRecreatePath(t *testing.T) {}<-cleanupDone}++func TestTypedContainerUpdatePreflightAcceptsAnyLocalRepoDigest(t *testing.T) {+ agent := &Agent{+ runtime: RuntimeDocker,+ docker: &fakeDockerClient{+ containerInspectFn: func(context.Context, string) (containertypes.InspectResponse, error) {+ return baseInspect(), nil+ },+ imageInspectWithRawFn: func(context.Context, string) (image.InspectResponse, []byte, error) {+ return image.InspectResponse{+ RepoDigests: []string{+ "docker.io/library/nginx@sha256:registry-old",+ "docker.io/library/nginx@sha256:registry-new",+ },+ }, nil, nil+ },+ },+ logger: zerolog.Nop(),+ }++ // The planned digest is the second local RepoDigest; the preflight must+ // still admit the update rather than refuse on a first-entry mismatch.+ if err := agent.TypedContainerUpdatePreflight(context.Background(), string(RuntimeDocker), "container-id", "sha256:registry-new"); err != nil {+ t.Fatalf("preflight refused a planned digest that matches a local RepoDigest: %v", err)+ }+}diff --git a/internal/dockeragent/registry.go b/internal/dockeragent/registry.goindex 6b800a53d6..c9bf2b3517 100644--- a/internal/dockeragent/registry.go+++ b/internal/dockeragent/registry.go@@ -182,11 +182,18 @@ func (r *RegistryChecker) CheckImageUpdate(ctx context.Context, image, currentDireturn nil}+ // currentDigest may be a comma-separated set of the local image's+ // RepoDigests; report the primary one while comparing against all of them.+ primaryCurrentDigest := currentDigest+ if idx := strings.Index(currentDigest, ","); idx >= 0 {+ primaryCurrentDigest = strings.TrimSpace(currentDigest[:idx])+ }+// Skip digest-pinned images (image@sha256:...)if registry == "" {return &ImageUpdateResult{Image: image,- CurrentDigest: currentDigest,+ CurrentDigest: primaryCurrentDigest,UpdateAvailable: false,CheckedAt: time.Now(),Error: "digest-pinned image",@@ -202,7 +209,7 @@ func (r *RegistryChecker) CheckImageUpdate(ctx context.Context, image, currentDiif cached.err != "" {return &ImageUpdateResult{Image: image,- CurrentDigest: currentDigest,+ CurrentDigest: primaryCurrentDigest,UpdateAvailable: false,CheckedAt: time.Now(),Error: cached.err,@@ -210,7 +217,7 @@ func (r *RegistryChecker) CheckImageUpdate(ctx context.Context, image, currentDi}return &ImageUpdateResult{Image: image,- CurrentDigest: currentDigest,+ CurrentDigest: primaryCurrentDigest,LatestDigest: cached.latestDigest,UpdateAvailable: r.digestsDiffer(currentDigest, cached.comparisonDigests),CheckedAt: time.Now(),@@ -231,7 +238,7 @@ func (r *RegistryChecker) CheckImageUpdate(ctx context.Context, image, currentDireturn &ImageUpdateResult{Image: image,- CurrentDigest: currentDigest,+ CurrentDigest: primaryCurrentDigest,UpdateAvailable: false,CheckedAt: time.Now(),Error: err.Error(),@@ -268,7 +275,7 @@ func (r *RegistryChecker) CheckImageUpdate(ctx context.Context, image, currentDireturn &ImageUpdateResult{Image: image,- CurrentDigest: currentDigest,+ CurrentDigest: primaryCurrentDigest,LatestDigest: publicLatestDigest,UpdateAvailable: updateAvailable,CheckedAt: time.Now(),@@ -281,20 +288,42 @@ func (r *RegistryChecker) digestsDiffer(current, latest string) bool {return false}- // Normalize digests - lowercase and remove "sha256:" prefix- normCurrent := strings.ToLower(strings.TrimPrefix(current, "sha256:"))-- // latest may contain multiple comma-separated digests (resolved + head)+ // latest may contain multiple comma-separated digests (resolved + head).+ // current may also hold several local RepoDigests for one image (#2110).+ latestSet := make(map[string]struct{})for _, l := range strings.Split(latest, ",") {- normLatest := strings.ToLower(strings.TrimPrefix(strings.TrimSpace(l), "sha256:"))- if normCurrent == normLatest {+ if normalized := normalizeComparisonDigest(l); normalized != "" {+ latestSet[normalized] = struct{}{}+ }+ }+ if len(latestSet) == 0 {+ return false+ }++ compared := false+ for _, c := range strings.Split(current, ",") {+ normalized := normalizeComparisonDigest(c)+ if normalized == "" {+ continue+ }+ compared = true+ if _, ok := latestSet[normalized]; ok {return false // Match found}}+ if !compared {+ return false+ }return true // No match found}+// normalizeComparisonDigest lowercases a digest and removes the "sha256:"+// prefix so registry and RepoDigest spellings compare equal.+func normalizeComparisonDigest(digest string) string {+ return strings.ToLower(strings.TrimPrefix(strings.TrimSpace(digest), "sha256:"))+}+// fetchDigest retrieves the digest for an image from the registry.// Returns the resolved platform-specific digest AND the raw HEAD digest (which might be a manifest list).func (r *RegistryChecker) fetchDigest(ctx context.Context, registry, repository, tag, arch, goos, variant string) (string, string, error) {