return error if at least one container fails to start

This makes docker start exit with exit code 1 if at least one container
didn't start. This also prints an error at the end.
Upstream-commit: d1ad0e278d67baad46168f6d04a56550a287d4a7
Component: engine
This commit is contained in:
unclejack
2013-08-23 18:59:11 +03:00
parent 81b8022046
commit a66e92affc

View File

@ -584,15 +584,17 @@ func (cli *DockerCli) CmdStart(args ...string) error {
return nil
}
var encounteredError error
for _, name := range args {
_, _, err := cli.call("POST", "/containers/"+name+"/start", nil)
if err != nil {
fmt.Fprintf(cli.err, "%s\n", err)
encounteredError = fmt.Errorf("Error: failed to start one or more containers")
} else {
fmt.Fprintf(cli.out, "%s\n", name)
}
}
return nil
return encounteredError
}
func (cli *DockerCli) CmdInspect(args ...string) error {