mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
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.
This commit is contained in:
parent
ccc2276469
commit
d1ad0e278d
1 changed files with 3 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue