code: func ExpandContainerSpec(n *api.NodeDescription, t *api.Task) (*api.ContainerSpec, error) {
  	container := t.Spec.GetContainer()
  	if container == nil {
  		return nil, errors.Errorf("task missing ContainerSpec to expand")
  	}
  
  	container = container.Copy()
  	ctx := NewContext(n, t)
  
  	var err error
  	container.Env, err = expandEnv(ctx, container.Env)
  	if err != nil {
  		return container, errors.Wrap(err, "expanding env failed")
  	}
  
  	// For now, we only allow templating of string-based mount fields
  	container.Mounts, err = expandMounts(ctx, container.Mounts)
  	if err != nil {
  		return container, errors.Wrap(err, "expanding mounts failed")
  	}
  
  	container.Hostname, err = ctx.Expand(container.Hostname)
  	return container, errors.Wrap(err, "expanding hostname failed")
  }
docs: // ExpandContainerSpec expands templated fields in the runtime using the task
  // state and the node where it is scheduled to run.
  // Templating is all evaluated on the agent-side, before execution.
  //
  // Note that these are projected only on runtime values, since active task
  // values are typically manipulated in the manager.