daemon: Hide empty containerd Git revisions in docker version

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 <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski authored and Paweł Gronowski committed 2026-10-29 15:44:38 +01:00
1 parent 9f07d9222f
commit 31014d1c40
2 files changed
+10 -8

No files matched your search

+7 -5
View File
@@ -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
}
@@ -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 {