hashicorp/nomad · error

hostname is not currently supported on driver %s

Error message

hostname is not currently supported on driver %s

What it means

If the task group's first network entry sets a Hostname, newNetworkManager requires the driver to support hostname setting; only Docker does (per the linked issue). For any other driver the manager rejects the group with this error. It exists because bridged-mode hostname setup is unsupported outside Docker (nomad#11180).

Source

Thrown at client/allocrunner/network_manager_linux.go:103

		if caps.MustInitiateNetwork {
			if networkInitiator != "" {
				return nil, fmt.Errorf("tasks %s and %s want to initiate networking but only one driver can do so", networkInitiator, task.Name)
			}
			netManager, ok := driver.(drivers.DriverNetworkManager)
			if !ok {
				return nil, fmt.Errorf("driver %s does not implement network management RPCs", task.Driver)
			}

			nm = netManager
			networkInitiator = task.Name
		} else if len(tg.Networks) > 0 && tg.Networks[0].Hostname != "" {
			// TODO jrasell: remove once the default linux network manager
			//  supports setting the hostname in bridged mode. This currently
			//  indicates only Docker supports this, which is true unless a
			//  custom driver can which means this check still holds as true as
			//  we can tell.
			//  Please see: https://github.com/hashicorp/nomad/issues/11180
			return nil, fmt.Errorf("hostname is not currently supported on driver %s", task.Driver)
		}

		// mark this driver's capabilities as checked
		driverCaps[task.Driver] = struct{}{}
	}

	return nm, nil
}

// defaultNetworkManager creates a network namespace for the alloc
type defaultNetworkManager struct{}

// CreateNetwork is the CreateNetwork implementation of the
// drivers.DriverNetworkManager interface function. It does not currently
// support setting the hostname of the network namespace.
func (*defaultNetworkManager) CreateNetwork(allocID string, _ *drivers.NetworkCreateRequest) (*drivers.NetworkIsolationSpec, bool, error) {
	netns, err := nsutil.NewNS(allocID)
	if err != nil {

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Remove the hostname field from the group network block, or use a Docker task for the network-initiating task.
  2. Set the hostname inside the task itself (e.g. via the driver's own options or in-container commands).
  3. Track/upgrade against the fix for nomad issue #11180 if hostname support for bridged mode is needed broadly.

Example fix

// before
network {
  mode = "bridge"
  hostname = "web"
}
// after
network {
  mode = "bridge"
}
Defensive patterns

Strategy: validation

Validate before calling

// reject hostname in group network unless driver is docker
if net.Hostname != "" && driver != "docker" { reject() }

Prevention

When it happens

Trigger: task group declares network { hostname = "..." } (non-empty tg.Networks[0].Hostname) while the initiating task's driver is not Docker (and the default bridge manager path is taken).

Common situations: Copying a Docker job's hostname stanza into an exec/java/raw_exec task group; upgrading jobs to group-level network hostname with mixed drivers; custom drivers that claim bridge support but no hostname support.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/47dfde1ae9e76886. Report an issue: GitHub.