Merge pull request #22777 from WeiZhang555/wait-restarting

Bug fix: `docker run -i --restart always` hangs
Upstream-commit: 4dafd107ad0cb89e1a7f9e3bcc66fb6a5a5c99c5
Component: engine
This commit is contained in:
Vincent Demeester
2016-06-12 13:01:20 +02:00
committed by GitHub
3 changed files with 42 additions and 2 deletions

View File

@ -288,7 +288,7 @@ func runRun(dockerCli *client.DockerCli, flags *pflag.FlagSet, opts *runOptions,
}
} else {
// No Autoremove: Simply retrieve the exit code
if !config.Tty {
if !config.Tty && hostConfig.RestartPolicy.IsNone() {
// In non-TTY mode, we can't detach, so we must wait for container exit
if status, err = client.ContainerWait(ctx, createResponse.ID); err != nil {
return err