code: func (e *executor) Controller(t *api.Task) (exec.Controller, error) {
  	dependencyGetter := template.NewTemplatedDependencyGetter(agent.Restrict(e.dependencies, t), t, nil)
  
  	// Get the node description from the executor field
  	e.mutex.Lock()
  	nodeDescription := e.node
  	e.mutex.Unlock()
  
  	if t.Spec.GetAttachment() != nil {
  		return newNetworkAttacherController(e.backend, e.imageBackend, e.volumeBackend, t, nodeDescription, dependencyGetter)
  	}
  
  	var ctlr exec.Controller
  	switch r := t.Spec.GetRuntime().(type) {
  	case *api.TaskSpec_Generic:
  		logrus.WithFields(logrus.Fields{
  			"kind":     r.Generic.Kind,
  			"type_url": r.Generic.Payload.TypeUrl,
  		}).Debug("custom runtime requested")
  		runtimeKind, err := naming.Runtime(t.Spec)
  		if err != nil {
  			return ctlr, err
  		}
  		switch runtimeKind {
  		case string(swarmtypes.RuntimePlugin):
  			if !e.backend.HasExperimental() {
  				return ctlr, fmt.Errorf("runtime type %q only supported in experimental", swarmtypes.RuntimePlugin)
  			}
  			c, err := plugin.NewController(e.pluginBackend, t)
  			if err != nil {
  				return ctlr, err
  			}
  			ctlr = c
  		default:
  			return ctlr, fmt.Errorf("unsupported runtime type: %q", runtimeKind)
  		}
  	case *api.TaskSpec_Container:
  		c, err := newController(e.backend, e.imageBackend, e.volumeBackend, t, nodeDescription, dependencyGetter)
  		if err != nil {
  			return ctlr, err
  		}
  		ctlr = c
  	default:
  		return ctlr, fmt.Errorf("unsupported runtime: %q", r)
  	}
  
  	return ctlr, nil
  }
docs: // Controller returns a docker container runner.