diff --git a/daemon/info_unix.go b/daemon/info_unix.go index f34a03307cef442513767039224342a6fa3eb39a..06a67271b5a66e7f3ab6b355bba4e7c41a622bff 100644 --- a/daemon/info_unix.go +++ b/daemon/info_unix.go @@ -72,7 +72,9 @@ func (daemon *Daemon) fillPlatformInfo(v *types.Info, sysInfo *sysinfo.SysInfo) v.InitCommit.ID = "N/A" } else { v.InitCommit.ID = commit - v.InitCommit.Expected = dockerversion.InitCommitID[0:len(commit)] + if len(dockerversion.InitCommitID) > len(commit) { + v.InitCommit.Expected = dockerversion.InitCommitID[0:len(commit)] + } } } else { logrus.Warnf("failed to retrieve %s version: %s", defaultInitBinary, err)