code: func (engine *DockerTaskEngine) sweepTask(task *apitask.Task) {
  	for _, cont := range task.Containers {
  		err := engine.removeContainer(task, cont)
  		if err != nil {
  			seelog.Debugf("Task engine [%s]: unable to remove old container [%s]: %v",
  				task.Arn, cont.Name, err)
  		}
  		// Internal container(created by ecs-agent) state isn't recorded
  		if cont.IsInternal() {
  			continue
  		}
  		err = engine.imageManager.RemoveContainerReferenceFromImageState(cont)
  		if err != nil {
  			seelog.Errorf("Task engine [%s]: Unable to remove container [%s] reference from image state: %v",
  				task.Arn, cont.Name, err)
  		}
  	}
  
  	// Clean metadata directory for task
  	if engine.cfg.ContainerMetadataEnabled {
  		err := engine.metadataManager.Clean(task.Arn)
  		if err != nil {
  			seelog.Warnf("Task engine [%s]: clean task metadata failed: %v", task.Arn, err)
  		}
  	}
  	engine.saver.Save()
  }
docs: // sweepTask deletes all the containers associated with a task