Move the attach prevention from server to client

Upstream-commit: c106ed32ea7613573a2081d47ad2498429ac86f2
Component: engine
This commit is contained in:
Guillaume J. Charmes
2013-06-17 15:40:04 -07:00
parent cdeb24fafc
commit fa0630fa0a
2 changed files with 4 additions and 3 deletions

View File

@ -1058,6 +1058,10 @@ func (cli *DockerCli) CmdAttach(args ...string) error {
return err
}
if !container.State.Running {
return fmt.Errorf("Impossible to attach to a stopped container, start it first")
}
splitStderr := container.Config.Tty
connections := 1

View File

@ -930,9 +930,6 @@ func (srv *Server) ContainerAttach(name string, logs, stream, stdin, stdout, std
if container.State.Ghost {
return fmt.Errorf("Impossible to attach to a ghost container")
}
if !container.State.Running {
return fmt.Errorf("Impossible to attach to a stopped container, start it first")
}
var (
cStdin io.ReadCloser