mirror of https://github.com/docker/docs.git
Merge pull request #21345 from duglin/BetterError
Add the name of the exe that's trying to be executed
This commit is contained in:
commit
02a90d0399
|
@ -20,8 +20,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
errCmdNotFound = "Container command not found or does not exist."
|
errCmdNotFound = "not found or does not exist."
|
||||||
errCmdCouldNotBeInvoked = "Container command could not be invoked."
|
errCmdCouldNotBeInvoked = "could not be invoked."
|
||||||
)
|
)
|
||||||
|
|
||||||
func (cid *cidFile) Close() error {
|
func (cid *cidFile) Close() error {
|
||||||
|
@ -51,12 +51,14 @@ func runStartContainerErr(err error) error {
|
||||||
trimmedErr := strings.Trim(err.Error(), "Error response from daemon: ")
|
trimmedErr := strings.Trim(err.Error(), "Error response from daemon: ")
|
||||||
statusError := Cli.StatusError{StatusCode: 125}
|
statusError := Cli.StatusError{StatusCode: 125}
|
||||||
|
|
||||||
switch trimmedErr {
|
if strings.HasPrefix(trimmedErr, "Container command") {
|
||||||
case errCmdNotFound:
|
if strings.Contains(trimmedErr, errCmdNotFound) {
|
||||||
statusError = Cli.StatusError{StatusCode: 127}
|
statusError = Cli.StatusError{StatusCode: 127}
|
||||||
case errCmdCouldNotBeInvoked:
|
} else if strings.Contains(trimmedErr, errCmdCouldNotBeInvoked) {
|
||||||
statusError = Cli.StatusError{StatusCode: 126}
|
statusError = Cli.StatusError{StatusCode: 126}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return statusError
|
return statusError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,12 +140,12 @@ func (daemon *Daemon) containerStart(container *container.Container) (err error)
|
||||||
strings.Contains(err.Error(), "no such file or directory") ||
|
strings.Contains(err.Error(), "no such file or directory") ||
|
||||||
strings.Contains(err.Error(), "system cannot find the file specified") {
|
strings.Contains(err.Error(), "system cannot find the file specified") {
|
||||||
container.ExitCode = 127
|
container.ExitCode = 127
|
||||||
err = fmt.Errorf("Container command not found or does not exist.")
|
err = fmt.Errorf("Container command '%s' not found or does not exist.", container.Path)
|
||||||
}
|
}
|
||||||
// set to 126 for container cmd can't be invoked errors
|
// set to 126 for container cmd can't be invoked errors
|
||||||
if strings.Contains(err.Error(), syscall.EACCES.Error()) {
|
if strings.Contains(err.Error(), syscall.EACCES.Error()) {
|
||||||
container.ExitCode = 126
|
container.ExitCode = 126
|
||||||
err = fmt.Errorf("Container command could not be invoked.")
|
err = fmt.Errorf("Container command '%s' could not be invoked.", container.Path)
|
||||||
}
|
}
|
||||||
|
|
||||||
container.Reset(false)
|
container.Reset(false)
|
||||||
|
|
Loading…
Reference in New Issue