Improve error message for ENOTDIR errors

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 83ae501f1d216600eebf182e7dc29e285c4b10bc
Component: engine
This commit is contained in:
Brian Goff
2016-07-18 10:21:48 -04:00
parent 8a3ff02fe8
commit 8453f0d859

View File

@ -158,6 +158,12 @@ func (daemon *Daemon) containerStart(container *container.Container) (err error)
container.SetExitCode(126)
}
// attempted to mount a file onto a directory, or a directory onto a file, maybe from user specified bind mounts
if strings.Contains(errDesc, syscall.ENOTDIR.Error()) {
errDesc += ": Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type"
container.SetExitCode(127)
}
container.Reset(false)
return fmt.Errorf("%s", errDesc)