1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Move the attach prevention from server to client

This commit is contained in:
Guillaume J. Charmes 2013-06-17 15:40:04 -07:00
parent bd9bf9b646
commit c106ed32ea
2 changed files with 4 additions and 3 deletions

View file

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

View file

@ -930,9 +930,6 @@ func (srv *Server) ContainerAttach(name string, logs, stream, stdin, stdout, std
if container.State.Ghost { if container.State.Ghost {
return fmt.Errorf("Impossible to attach to a ghost container") 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 ( var (
cStdin io.ReadCloser cStdin io.ReadCloser