{"id":"05c38b28b11eb81e","repo":"docker/cli","slug":"option-bind-recursive-readonly-requires-readonl","errorCode":null,"errorMessage":"option 'bind-recursive=readonly' requires 'readonly' to be specified in conjunction","messagePattern":"option 'bind-recursive=readonly' requires 'readonly' to be specified in conjunction","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"opts/mount_utils.go","lineNumber":25,"sourceCode":"\n\t\"github.com/moby/moby/api/types/mount\"\n)\n\n// validateMountOptions performs client-side validation of mount options. Similar\n// validation happens on the daemon side, but this validation allows us to\n// produce user-friendly errors matching command-line options.\nfunc 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","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/opts/mount_utils.go#L7-L43","documentation":"Error \"option 'bind-recursive=readonly' requires 'readonly' to be specified in conjunction\" thrown in docker/cli.","triggerScenarios":"Thrown at opts/mount_utils.go:25 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}