Browse Source

Merge pull request #40361 from thaJeztah/no_panic

prevent panic if TINI_COMMIT isn't set during build
Brian Goff 5 years ago
parent
commit
9d4c722c53
1 changed files with 3 additions and 1 deletions
  1. 3 1
      daemon/info_unix.go

+ 3 - 1
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)