code: func (ds *dockerService) ListContainers(_ context.Context, r *runtimeapi.ListContainersRequest) (*runtimeapi.ListContainersResponse, error) {
  	filter := r.GetFilter()
  	opts := dockertypes.ContainerListOptions{All: true}
  
  	opts.Filters = dockerfilters.NewArgs()
  	f := newDockerFilter(&opts.Filters)
  	// Add filter to get *only* (non-sandbox) containers.
  	f.AddLabel(containerTypeLabelKey, containerTypeLabelContainer)
  
  	if filter != nil {
  		if filter.Id != "" {
  			f.Add("id", filter.Id)
  		}
  		if filter.State != nil {
  			f.Add("status", toDockerContainerStatus(filter.GetState().State))
  		}
  		if filter.PodSandboxId != "" {
  			f.AddLabel(sandboxIDLabelKey, filter.PodSandboxId)
  		}
  
  		if filter.LabelSelector != nil {
  			for k, v := range filter.LabelSelector {
  				f.AddLabel(k, v)
  			}
  		}
  	}
  	containers, err := ds.client.ListContainers(opts)
  	if err != nil {
  		return nil, err
  	}
  	// Convert docker to runtime api containers.
  	result := []*runtimeapi.Container{}
  	for i := range containers {
  		c := containers[i]
  
  		converted, err := toRuntimeAPIContainer(&c)
  		if err != nil {
  			klog.V(4).Infof("Unable to convert docker to runtime API container: %v", err)
  			continue
  		}
  
  		result = append(result, converted)
  	}
  
  	return &runtimeapi.ListContainersResponse{Containers: result}, nil
  }
docs: // ListContainers lists all containers matching the filter.