Browse code

Improve error message for ENOTDIR errors

Signed-off-by: Brian Goff <cpuguy83@gmail.com>

Brian Goff authored on 2016/07/18 23:21:48
Showing 1 changed files
... ...
@@ -158,6 +158,12 @@ func (daemon *Daemon) containerStart(container *container.Container) (err error)
158 158
 			container.SetExitCode(126)
159 159
 		}
160 160
 
161
+		// attempted to mount a file onto a directory, or a directory onto a file, maybe from user specified bind mounts
162
+		if strings.Contains(errDesc, syscall.ENOTDIR.Error()) {
163
+			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"
164
+			container.SetExitCode(127)
165
+		}
166
+
161 167
 		container.Reset(false)
162 168
 
163 169
 		return fmt.Errorf("%s", errDesc)