code: func (r *controller) waitReady(pctx context.Context) error {
  	if err := r.checkClosed(); err != nil {
  		return err
  	}
  
  	ctx, cancel := context.WithCancel(pctx)
  	defer cancel()
  
  	eventq := r.adapter.events(ctx)
  
  	ctnr, err := r.adapter.inspect(ctx)
  	if err != nil {
  		if !isUnknownContainer(err) {
  			return errors.Wrap(err, "inspect container failed")
  		}
  	} else {
  		switch ctnr.State.Status {
  		case "running", "exited", "dead":
  			return nil
  		}
  	}
  
  	for {
  		select {
  		case event := <-eventq:
  			if !r.matchevent(event) {
  				continue
  			}
  
  			switch event.Action {
  			case "start":
  				return nil
  			}
  		case <-ctx.Done():
  			return ctx.Err()
  		case <-r.closed:
  			return r.err
  		}
  	}
  }
docs: // waitReady waits for a container to be "ready".
  // Ready means it's past the started state.