diff options
author | yangshukui <yangshukui@huawei.com> | 2017-05-20 11:27:45 +0800 |
---|---|---|
committer | yangshukui <yangshukui@huawei.com> | 2017-05-20 11:27:45 +0800 |
commit | 5010e09534c4595ea4bc3f53a415626fc9e9d3b1 (patch) | |
tree | f09af4b2e42e766a294f29acc80fe9f37c0155e1 /daemon/attach.go | |
parent | 77c9728847358a3ed3581d828fb0753017e1afd3 (diff) | |
download | docker-5010e09534c4595ea4bc3f53a415626fc9e9d3b1.tar.gz |
Add a restarting check to ContainerAttach
Signed-off-by: yangshukui <yangshukui@huawei.com>
Diffstat (limited to 'daemon/attach.go')
-rw-r--r-- | daemon/attach.go | 6 |
1 files changed, 5 insertions, 1 deletions
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) } |