Explorar o código

Forbid attach to ghost

Guillaume J. Charmes %!s(int64=12) %!d(string=hai) anos
pai
achega
b76d63cb0c
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      commands.go

+ 4 - 0
commands.go

@@ -836,6 +836,10 @@ func (srv *Server) CmdAttach(stdin io.ReadCloser, stdout rcli.DockerConn, args .
 		return fmt.Errorf("No such container: %s", name)
 	}
 
+	if container.State.Ghost {
+		return fmt.Errorf("Impossible to attach to a ghost container")
+	}
+
 	if container.Config.Tty {
 		stdout.SetOptionRawTerminal()
 	}