{"record":{"id":"47dfde1ae9e76886","repo":"hashicorp/nomad","slug":"hostname-is-not-currently-supported-on-driver-s","errorCode":null,"errorMessage":"hostname is not currently supported on driver %s","messagePattern":"hostname is not currently supported on driver (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/network_manager_linux.go","lineNumber":103,"sourceCode":"\t\tif caps.MustInitiateNetwork {\n\t\t\tif networkInitiator != \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"tasks %s and %s want to initiate networking but only one driver can do so\", networkInitiator, task.Name)\n\t\t\t}\n\t\t\tnetManager, ok := driver.(drivers.DriverNetworkManager)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"driver %s does not implement network management RPCs\", task.Driver)\n\t\t\t}\n\n\t\t\tnm = netManager\n\t\t\tnetworkInitiator = task.Name\n\t\t} else if len(tg.Networks) > 0 && tg.Networks[0].Hostname != \"\" {\n\t\t\t// TODO jrasell: remove once the default linux network manager\n\t\t\t//  supports setting the hostname in bridged mode. This currently\n\t\t\t//  indicates only Docker supports this, which is true unless a\n\t\t\t//  custom driver can which means this check still holds as true as\n\t\t\t//  we can tell.\n\t\t\t//  Please see: https://github.com/hashicorp/nomad/issues/11180\n\t\t\treturn nil, fmt.Errorf(\"hostname is not currently supported on driver %s\", task.Driver)\n\t\t}\n\n\t\t// mark this driver's capabilities as checked\n\t\tdriverCaps[task.Driver] = struct{}{}\n\t}\n\n\treturn nm, nil\n}\n\n// defaultNetworkManager creates a network namespace for the alloc\ntype defaultNetworkManager struct{}\n\n// CreateNetwork is the CreateNetwork implementation of the\n// drivers.DriverNetworkManager interface function. It does not currently\n// support setting the hostname of the network namespace.\nfunc (*defaultNetworkManager) CreateNetwork(allocID string, _ *drivers.NetworkCreateRequest) (*drivers.NetworkIsolationSpec, bool, error) {\n\tnetns, err := nsutil.NewNS(allocID)\n\tif err != nil {","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/network_manager_linux.go#L85-L121","documentation":"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).","triggerScenarios":"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).","commonSituations":"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.","solutions":["Remove the hostname field from the group network block, or use a Docker task for the network-initiating task.","Set the hostname inside the task itself (e.g. via the driver's own options or in-container commands).","Track/upgrade against the fix for nomad issue #11180 if hostname support for bridged mode is needed broadly."],"exampleFix":"// before\nnetwork {\n  mode = \"bridge\"\n  hostname = \"web\"\n}\n// after\nnetwork {\n  mode = \"bridge\"\n}","handlingStrategy":"validation","validationCode":"// reject hostname in group network unless driver is docker\nif net.Hostname != \"\" && driver != \"docker\" { reject() }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only set group network hostname on docker-driver task groups.","Keep hostname configuration inside the task for other drivers.","Watch upstream nomad#11180 for broader hostname support."],"tags":["nomad","hostname","bridge-network","docker"],"backgroundTag":"hostname-unsupported-on-driver","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}