From 8471742a8ae3887482d5e8b35d808e045d043ab8 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 19 Oct 2017 00:56:01 +0000 Subject: [PATCH] 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 --- cli/command/container/utils.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cli/command/container/utils.go b/cli/command/container/utils.go index 3652d672d9..dbd85c0a40 100644 --- a/cli/command/container/utils.go +++ b/cli/command/container/utils.go @@ -37,7 +37,12 @@ func waitExitOrRemoved(ctx context.Context, dockerCli command.Cli, containerID s go func() { select { 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: logrus.Errorf("error waiting for container: %v", err) statusC <- 125