code: func (daemon *Daemon) reduceContainers(config *types.ContainerListOptions, reducer containerReducer) ([]*types.Container, error) {
  	if err := config.Filters.Validate(acceptedPsFilterTags); err != nil {
  		return nil, err
  	}
  
  	var (
  		view       = daemon.containersReplica.Snapshot()
  		containers = []*types.Container{}
  	)
  
  	ctx, err := daemon.foldFilter(view, config)
  	if err != nil {
  		return nil, err
  	}
  
  	// fastpath to only look at a subset of containers if specific name
  	// or ID matches were provided by the user--otherwise we potentially
  	// end up querying many more containers than intended
  	containerList, err := daemon.filterByNameIDMatches(view, ctx)
  	if err != nil {
  		return nil, err
  	}
  
  	for i := range containerList {
  		t, err := daemon.reducePsContainer(&containerList[i], ctx, reducer)
  		if err != nil {
  			if err != errStopIteration {
  				return nil, err
  			}
  			break
  		}
  		if t != nil {
  			containers = append(containers, t)
  			ctx.idx++
  		}
  	}
  
  	return containers, nil
  }
docs: // reduceContainers parses the user's filtering options and generates the list of containers to return based on a reducer.