浏览代码

Improve error message for ENOTDIR errors

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Brian Goff 9 年之前
父节点
当前提交
83ae501f1d
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      daemon/start.go

+ 6 - 0
daemon/start.go

@@ -158,6 +158,12 @@ func (daemon *Daemon) containerStart(container *container.Container) (err error)
 			container.SetExitCode(126)
 			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)
 		container.Reset(false)
 
 
 		return fmt.Errorf("%s", errDesc)
 		return fmt.Errorf("%s", errDesc)