Browse code

Add a restarting check to ContainerAttach

Signed-off-by: yangshukui <yangshukui@huawei.com>

yangshukui authored on 2017/05/20 12:27:45
Showing 1 changed files
... ...
@@ -31,7 +31,11 @@ func (daemon *Daemon) ContainerAttach(prefixOrName string, c *backend.ContainerA
31 31
 		return err
32 32
 	}
33 33
 	if container.IsPaused() {
34
-		err := fmt.Errorf("Container %s is paused. Unpause the container before attach", prefixOrName)
34
+		err := fmt.Errorf("Container %s is paused, unpause the container before attach.", prefixOrName)
35
+		return errors.NewRequestConflictError(err)
36
+	}
37
+	if container.IsRestarting() {
38
+		err := fmt.Errorf("Container %s is restarting, wait until the container is running.", prefixOrName)
35 39
 		return errors.NewRequestConflictError(err)
36 40
 	}
37 41