{"id":"5dd563038c0031bf","repo":"docker/cli","slug":"option-bind-recursive-readonly-requires-bind-pr","errorCode":null,"errorMessage":"option 'bind-recursive=readonly' requires 'bind-propagation=rprivate' to be specified in conjunction","messagePattern":"option 'bind-recursive=readonly' requires 'bind-propagation=rprivate' to be specified in conjunction","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"opts/mount_utils.go","lineNumber":32,"sourceCode":"func validateMountOptions(m *mount.Mount) error {\n\tif err := validateExclusiveOptions(m); err != nil {\n\t\treturn err\n\t}\n\n\tif m.BindOptions != nil {\n\t\tif m.BindOptions.ReadOnlyNonRecursive && !m.ReadOnly {\n\t\t\treturn errors.New(\"option 'bind-recursive=writable' requires 'readonly' to be specified in conjunction\")\n\t\t}\n\t\tif m.BindOptions.ReadOnlyForceRecursive {\n\t\t\tif !m.ReadOnly {\n\t\t\t\treturn errors.New(\"option 'bind-recursive=readonly' requires 'readonly' to be specified in conjunction\")\n\t\t\t}\n\t\t\tif m.BindOptions.Propagation != mount.PropagationRPrivate {\n\t\t\t\t// FIXME(thaJeztah): this is missing daemon-side validation\n\t\t\t\t//\n\t\t\t\t//\tdocker run --rm --mount type=bind,src=/var/run,target=/foo,bind-recursive=readonly,readonly alpine\n\t\t\t\t//\t# no error\n\t\t\t\treturn errors.New(\"option 'bind-recursive=readonly' requires 'bind-propagation=rprivate' to be specified in conjunction\")\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// validateExclusiveOptions checks if the given mount config only contains\n// options for the given mount-type.\n//\n// This is the client-side equivalent of [mounts.validateExclusiveOptions] in\n// the daemon, but with error-messages matching client-side flags / options.\n//\n// [mounts.validateExclusiveOptions]: https://github.com/moby/moby/blob/v2.0.0-beta.6/daemon/volume/mounts/validate.go#L31-L50\nfunc validateExclusiveOptions(m *mount.Mount) error {\n\tif m.Type == \"\" {\n\t\treturn errors.New(\"type is required\")\n\t}","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/opts/mount_utils.go#L14-L50","documentation":"Error \"option 'bind-recursive=readonly' requires 'bind-propagation=rprivate' to be specified in conjunction\" thrown in docker/cli.","triggerScenarios":"Thrown at opts/mount_utils.go:32 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}