|
@@ -7,6 +7,8 @@ import (
|
|
"strings"
|
|
"strings"
|
|
"syscall"
|
|
"syscall"
|
|
|
|
|
|
|
|
+ "google.golang.org/grpc"
|
|
|
|
+
|
|
"github.com/Sirupsen/logrus"
|
|
"github.com/Sirupsen/logrus"
|
|
"github.com/docker/docker/container"
|
|
"github.com/docker/docker/container"
|
|
"github.com/docker/docker/errors"
|
|
"github.com/docker/docker/errors"
|
|
@@ -131,24 +133,24 @@ func (daemon *Daemon) containerStart(container *container.Container) (err error)
|
|
}
|
|
}
|
|
|
|
|
|
if err := daemon.containerd.Create(container.ID, *spec, libcontainerd.WithRestartManager(container.RestartManager(true))); err != nil {
|
|
if err := daemon.containerd.Create(container.ID, *spec, libcontainerd.WithRestartManager(container.RestartManager(true))); err != nil {
|
|
|
|
+ errDesc := grpc.ErrorDesc(err)
|
|
|
|
+ logrus.Errorf("Create container failed with error: %s", errDesc)
|
|
// if we receive an internal error from the initial start of a container then lets
|
|
// if we receive an internal error from the initial start of a container then lets
|
|
// return it instead of entering the restart loop
|
|
// return it instead of entering the restart loop
|
|
// set to 127 for container cmd not found/does not exist)
|
|
// set to 127 for container cmd not found/does not exist)
|
|
- if strings.Contains(err.Error(), "executable file not found") ||
|
|
|
|
- strings.Contains(err.Error(), "no such file or directory") ||
|
|
|
|
- strings.Contains(err.Error(), "system cannot find the file specified") {
|
|
|
|
|
|
+ if strings.Contains(errDesc, "executable file not found") ||
|
|
|
|
+ strings.Contains(errDesc, "no such file or directory") ||
|
|
|
|
+ strings.Contains(errDesc, "system cannot find the file specified") {
|
|
container.ExitCode = 127
|
|
container.ExitCode = 127
|
|
- 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(errDesc, syscall.EACCES.Error()) {
|
|
container.ExitCode = 126
|
|
container.ExitCode = 126
|
|
- err = fmt.Errorf("Container command '%s' could not be invoked", container.Path)
|
|
|
|
}
|
|
}
|
|
|
|
|
|
container.Reset(false)
|
|
container.Reset(false)
|
|
|
|
|
|
- return err
|
|
|
|
|
|
+ return fmt.Errorf("%s", errDesc)
|
|
}
|
|
}
|
|
|
|
|
|
return nil
|
|
return nil
|