浏览代码

Forbid attach to ghost

Guillaume J. Charmes 12 年之前
父节点
当前提交
b76d63cb0c
共有 1 个文件被更改,包括 4 次插入0 次删除
  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()
 	}