Merge pull request #45006 from corhere/runtime-eisdir

daemon: handle EISDIR error from runtime
This commit is contained in:
Cory Snider 2023-02-15 14:16:30 -05:00 committed by GitHub
commit dacec4ec82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -160,6 +160,17 @@ func setExitCodeFromError(setExitCode func(exitStatus), err error) error {
return startInvalidConfigError(errDesc)
}
// Go 1.20 changed the error for attempting to execute a directory from
// syscall.EACCESS to syscall.EISDIR. Unfortunately docker/cli checks
// whether the error message contains syscall.EACCESS.Error() to
// determine whether to exit with code 126 or 125, so we have little
// choice but to fudge the error string.
if contains(errDesc, syscall.EISDIR.Error()) {
errDesc += ": " + syscall.EACCES.Error()
setExitCode(exitEaccess)
return startInvalidConfigError(errDesc)
}
// attempted to mount a file onto a directory, or a directory onto a file, maybe from user specified bind mounts
if 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"