Fix TerminationMessagePath

This commit is contained in:
Random-Liu 2016-03-30 16:03:49 -07:00
parent 2a690cc5e2
commit 5dbac3a8b8

View File

@ -382,11 +382,14 @@ func (dm *DockerManager) inspectContainer(id string, podName, podNamespace strin
terminationMessagePath := containerInfo.TerminationMessagePath
if terminationMessagePath != "" {
if path, found := iResult.Volumes[terminationMessagePath]; found {
if data, err := ioutil.ReadFile(path); err != nil {
message = fmt.Sprintf("Error on reading termination-log %s: %v", path, err)
} else {
message = string(data)
for _, mount := range iResult.Mounts {
if mount.Destination == terminationMessagePath {
path := mount.Source
if data, err := ioutil.ReadFile(path); err != nil {
message = fmt.Sprintf("Error on reading termination-log %s: %v", path, err)
} else {
message = string(data)
}
}
}
}