{"id":"6466fdd22e825c07","repo":"docker/cli","slug":"pid-invalid-pid-mode","errorCode":null,"errorMessage":"--pid: invalid PID mode","messagePattern":"--pid: invalid PID mode","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/opts.go","lineNumber":520,"sourceCode":"\t\t}\n\t\tdeviceMappings = append(deviceMappings, deviceMapping)\n\t}\n\n\t// collect all the environment variables for the container\n\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)","sourceCodeStart":502,"sourceCodeEnd":538,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/container/opts.go#L502-L538","documentation":"During parsing of run/create options, the value passed to --pid is wrapped in container.PidMode and checked with Valid(). PidMode only accepts an empty value, \"host\", or \"container:<name|id>\"; anything else fails validation and the CLI rejects the flag before creating the container.","triggerScenarios":"`docker run --pid=<value>` where value is not \"\", \"host\", or \"container:<name|id>\" — e.g. `--pid=private`, `--pid=container:` with an empty target, or a typo like `--pid=hots`.","commonSituations":"Typos of `host`; assuming Kubernetes/Podman-style values like `private` or `pod` work in Docker; scripts interpolating an empty container name into `container:$NAME` producing `container:`.","solutions":["Use one of the supported modes: `--pid=host` or `--pid=container:<name-or-id>`, or omit the flag for the default private PID namespace.","If using `container:<name>`, ensure the name/ID variable is non-empty and refers to an existing container.","Check for typos in the flag value."],"exampleFix":"# before\ndocker run --pid=private myimage\n# after (default is already a private PID namespace)\ndocker run myimage\n# or share the host PID namespace\ndocker run --pid=host myimage","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker-cli","docker-run","pid-namespace","flag-validation"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}