code: func (daemon *Daemon) ContainerRm(name string, config *types.ContainerRmConfig) error {
  	start := time.Now()
  	container, err := daemon.GetContainer(name)
  	if err != nil {
  		return err
  	}
  
  	// Container state RemovalInProgress should be used to avoid races.
  	if inProgress := container.SetRemovalInProgress(); inProgress {
  		err := fmt.Errorf("removal of container %s is already in progress", name)
  		return errdefs.Conflict(err)
  	}
  	defer container.ResetRemovalInProgress()
  
  	// check if container wasn't deregistered by previous rm since Get
  	if c := daemon.containers.Get(container.ID); c == nil {
  		return nil
  	}
  
  	if config.RemoveLink {
  		return daemon.rmLink(container, name)
  	}
  
  	err = daemon.cleanupContainer(container, config.ForceRemove, config.RemoveVolume)
  	containerActions.WithValues("delete").UpdateSince(start)
  
  	return err
  }
docs: // ContainerRm removes the container id from the filesystem. An error
  // is returned if the container is not found, or if the remove
  // fails. If the remove succeeds, the container name is released, and
  // network links are removed.