From 31014d1c401427572ac3652aa31c7340bf56d153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Wed, 28 Oct 2026 17:36:16 +0100 Subject: [PATCH] daemon: Hide empty containerd Git revisions in docker version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Omit the GitCommit component detail when containerd reports no revision and keep known revisions visible. Component details are optional informational fields, so omit unknown revisions rather than add a network lookup to daemon builds. Signed-off-by: Paweł Gronowski --- daemon/info_unix.go | 12 +++++++----- daemon/internal/containerd/server/embedded/server.go | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/daemon/info_unix.go b/daemon/info_unix.go index c7e289eccc..5f1982b7fb 100644 --- a/daemon/info_unix.go +++ b/daemon/info_unix.go @@ -441,13 +441,15 @@ func (daemon *Daemon) populateContainerdVersion(ctx context.Context, v *system.V return nil } - v.Components = append(v.Components, system.ComponentVersion{ + component := system.ComponentVersion{ Name: "containerd", Version: rv.Version, - Details: map[string]string{ - "GitCommit": rv.Revision, - }, - }) + } + if rv.Revision != "" { + component.Details = map[string]string{"GitCommit": rv.Revision} + } + + v.Components = append(v.Components, component) return nil } diff --git a/daemon/internal/containerd/server/embedded/server.go b/daemon/internal/containerd/server/embedded/server.go index a741fa56cd..ae102f3886 100644 --- a/daemon/internal/containerd/server/embedded/server.go +++ b/daemon/internal/containerd/server/embedded/server.go @@ -141,10 +141,10 @@ func Start(ctx context.Context, rootDir, stateDir string) (*Daemon, error) { } // setContainerdVersion makes the embedded server report the vendored containerd -// version in "docker info" instead of the source default ("2.2.4+unknown"). +// version in "docker info" and "docker version" instead of the source default. // -// The version comes from the build's module info. The git commit is not -// recorded there, so only the version is set. +// The version comes from the build's module info. +// The git commit is not recorded there, so only the version is set. func setContainerdVersion() { bi, ok := debug.ReadBuildInfo() if !ok {