From 63c010af992e458c782dd735f71a50a5d18ca2d5 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Thu, 26 Dec 2013 17:49:41 -0800 Subject: [PATCH] Exit with code 1 in case of error for `docker build` Upstream-commit: 4986958e7e61bb0439a59c46af000b157798b94a Component: engine --- components/engine/commands.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/engine/commands.go b/components/engine/commands.go index 0627261d53..97bfda5194 100644 --- a/components/engine/commands.go +++ b/components/engine/commands.go @@ -12,8 +12,8 @@ import ( "github.com/dotcloud/docker/archive" "github.com/dotcloud/docker/auth" "github.com/dotcloud/docker/engine" - "github.com/dotcloud/docker/registry" "github.com/dotcloud/docker/pkg/term" + "github.com/dotcloud/docker/registry" "github.com/dotcloud/docker/utils" "io" "io/ioutil" @@ -238,6 +238,10 @@ func (cli *DockerCli) CmdBuild(args ...string) error { } err = cli.stream("POST", fmt.Sprintf("/build?%s", v.Encode()), body, cli.out, headers) if jerr, ok := err.(*utils.JSONError); ok { + // If no error code is set, default to 1 + if jerr.Code == 0 { + jerr.Code = 1 + } return &utils.StatusError{Status: jerr.Message, StatusCode: jerr.Code} } return err