From 5010e09534c4595ea4bc3f53a415626fc9e9d3b1 Mon Sep 17 00:00:00 2001 From: yangshukui Date: Sat, 20 May 2017 11:27:45 +0800 Subject: [PATCH] Add a restarting check to ContainerAttach Signed-off-by: yangshukui --- daemon/attach.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/daemon/attach.go b/daemon/attach.go index a892799529..32410393a3 100644 --- a/daemon/attach.go +++ b/daemon/attach.go @@ -31,7 +31,11 @@ func (daemon *Daemon) ContainerAttach(prefixOrName string, c *backend.ContainerA return err } if container.IsPaused() { - err := fmt.Errorf("Container %s is paused. Unpause the container before attach", prefixOrName) + err := fmt.Errorf("Container %s is paused, unpause the container before attach.", prefixOrName) + return errors.NewRequestConflictError(err) + } + if container.IsRestarting() { + err := fmt.Errorf("Container %s is restarting, wait until the container is running.", prefixOrName) return errors.NewRequestConflictError(err) }