Show container wait error

If container wait has failed, show an error from the engine
and return an appropriate exit code.

This requires engine changes from https://github.com/moby/moby/pull/34999

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2017-10-19 00:56:01 +00:00
parent 718a245b6e
commit 8471742a8a
1 changed files with 6 additions and 1 deletions

View File

@ -37,7 +37,12 @@ func waitExitOrRemoved(ctx context.Context, dockerCli command.Cli, containerID s
go func() { go func() {
select { select {
case result := <-resultC: case result := <-resultC:
statusC <- int(result.StatusCode) if result.Error != nil {
logrus.Errorf("Error waiting for container: %v", result.Error.Message)
statusC <- 125
} else {
statusC <- int(result.StatusCode)
}
case err := <-errC: case err := <-errC:
logrus.Errorf("error waiting for container: %v", err) logrus.Errorf("error waiting for container: %v", err)
statusC <- 125 statusC <- 125