code: func (r *controller) Remove(ctx context.Context) error {
  	if err := r.checkClosed(); err != nil {
  		return err
  	}
  
  	if r.cancelPull != nil {
  		r.cancelPull()
  	}
  
  	// It may be necessary to shut down the task before removing it.
  	if err := r.Shutdown(ctx); err != nil {
  		if isUnknownContainer(err) {
  			return nil
  		}
  		// This may fail if the task was already shut down.
  		log.G(ctx).WithError(err).Debug("shutdown failed on removal")
  	}
  
  	// Try removing networks referenced in this task in case this
  	// task is the last one referencing it
  	if err := r.adapter.removeNetworks(ctx); err != nil {
  		if isUnknownContainer(err) {
  			return nil
  		}
  		return err
  	}
  
  	if err := r.adapter.remove(ctx); err != nil {
  		if isUnknownContainer(err) {
  			return nil
  		}
  
  		return err
  	}
  	return nil
  }
docs: // Remove the container and its resources.