{"record":{"id":"40799e3f5fbca4dc","repo":"docker/cli","slug":"uts-invalid-uts-mode","errorCode":null,"errorMessage":"--uts: invalid UTS mode","messagePattern":"--uts: invalid UTS mode","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/opts.go","lineNumber":525,"sourceCode":"\tenvVariables, err := opts.ReadKVEnvStrings(copts.envFile.GetSlice(), copts.env.GetSlice())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"--env-file: %w\", err)\n\t}\n\n\t// collect all the labels for the container\n\tlabels, err := opts.ReadKVStrings(copts.labelsFile.GetSlice(), copts.labels.GetSlice())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"--label-file: %w\", err)\n\t}\n\n\tpidMode := container.PidMode(copts.pidMode)\n\tif !pidMode.Valid() {\n\t\treturn nil, errors.New(\"--pid: invalid PID mode\")\n\t}\n\n\tutsMode := container.UTSMode(copts.utsMode)\n\tif !utsMode.Valid() {\n\t\treturn nil, errors.New(\"--uts: invalid UTS mode\")\n\t}\n\n\tusernsMode := container.UsernsMode(copts.usernsMode)\n\tif !usernsMode.Valid() {\n\t\treturn nil, errors.New(\"--userns: invalid USER mode\")\n\t}\n\n\tcgroupnsMode := container.CgroupnsMode(copts.cgroupnsMode)\n\tif !cgroupnsMode.Valid() {\n\t\treturn nil, errors.New(\"--cgroupns: invalid CGROUP mode\")\n\t}\n\n\trestartPolicy, err := opts.ParseRestartPolicy(copts.restartPolicy)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tloggingOpts, err := parseLoggingOpts(copts.loggingDriver, copts.loggingOpts.GetSlice())","sourceCodeStart":507,"sourceCodeEnd":543,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/container/opts.go#L507-L543","documentation":"Returned when the value passed to --uts fails container.UTSMode.Valid() (opts.go:523-526). Valid UTS modes are the empty string (default) or \"host\". Unlike --pid, container:<id> sharing is not supported for the UTS namespace, so any other value is rejected.","triggerScenarios":"Running `docker run --uts=<bad> ...` with anything other than empty or \"host\". Common offenders: `--uts=container:foo`, `--uts=private`, `--uts=hosk`.","commonSituations":"Assuming --uts supports the same `container:<id>` syntax as --pid/--ipc; mistyping \"host\"; expecting a \"private\" keyword (private is the default, not a named value).","solutions":["Use `--uts=host` to share the host UTS namespace (hostname).","Omit the flag for the default private UTS namespace.","Remove any container:<id> form -- it is unsupported for --uts."],"exampleFix":"// before\ndocker run --uts=container:webapp myimage\n// after\ndocker run --uts=host myimage","handlingStrategy":"validation","validationCode":"if um := container.UTSMode(copts.utsMode); !um.Valid() {\n    return fmt.Errorf(\"--uts: invalid UTS mode %q\", copts.utsMode)\n}","typeGuard":"// isValidUtsMode narrows acceptable --uts values.\nfunc isValidUtsMode(s string) bool {\n    return s == \"\" || s == \"host\"\n}","tryCatchPattern":null,"preventionTips":["Remember UTS supports only empty and host -- no container: form.","Validate in your CLI wrapper before sending to the daemon.","Use the built-in shell completion (host only) as a guide."],"tags":["docker-cli","uts-namespace","validation","namespace","container-create"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}