code: func (r *runtimeVM) AttachContainer(c *Container, inputStream io.Reader, outputStream, errorStream io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize) error {
  	logrus.Debug("runtimeVM.AttachContainer() start")
  	defer logrus.Debug("runtimeVM.AttachContainer() end")
  
  	// Initialize terminal resizing
  	kubecontainer.HandleResizing(resize, func(size remotecommand.TerminalSize) {
  		logrus.Debugf("Got a resize event: %+v", size)
  
  		if err := r.resizePty(r.ctx, c.ID(), "", size); err != nil {
  			logrus.Warnf("Failed to resize terminal: %v", err)
  		}
  	})
  
  	cInfo, ok := r.ctrs[c.ID()]
  	if !ok {
  		return errors.New("Could not retrieve container information")
  	}
  
  	opts := cio.AttachOptions{
  		Stdin:     inputStream,
  		Stdout:    outputStream,
  		Stderr:    errorStream,
  		Tty:       tty,
  		StdinOnce: c.stdinOnce,
  		CloseStdin: func() error {
  			return r.closeIO(r.ctx, c.ID(), "")
  		},
  	}
  
  	cInfo.cio.Attach(opts)
  
  	return nil
  }
docs: // AttachContainer attaches IO to a running container.