{"record":{"id":"06e19999b58a6f18","repo":"docker/cli","slug":"cluster-options-are-incompatible-with-type-bind","errorCode":null,"errorMessage":"cluster options are incompatible with type bind","messagePattern":"cluster options are incompatible with type bind","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/convert/volume.go","lineNumber":136,"sourceCode":"}\n\nfunc handleBindToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {\n\tresult := createMountFromVolume(volume)\n\n\tif volume.Source == \"\" {\n\t\treturn mount.Mount{}, errors.New(\"invalid bind source, source cannot be empty\")\n\t}\n\tif volume.Volume != nil {\n\t\treturn mount.Mount{}, errors.New(\"volume options are incompatible with type bind\")\n\t}\n\tif volume.Image != nil {\n\t\treturn mount.Mount{}, errors.New(\"image options are incompatible with type bind\")\n\t}\n\tif volume.Tmpfs != nil {\n\t\treturn mount.Mount{}, errors.New(\"tmpfs options are incompatible with type bind\")\n\t}\n\tif volume.Cluster != nil {\n\t\treturn mount.Mount{}, errors.New(\"cluster options are incompatible with type bind\")\n\t}\n\tif volume.Bind != nil {\n\t\tresult.BindOptions = &mount.BindOptions{\n\t\t\tPropagation: mount.Propagation(volume.Bind.Propagation),\n\t\t}\n\t}\n\treturn result, nil\n}\n\nfunc handleTmpfsToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {\n\tresult := createMountFromVolume(volume)\n\n\tif volume.Source != \"\" {\n\t\treturn mount.Mount{}, errors.New(\"invalid tmpfs source, source must be empty\")\n\t}\n\tif volume.Bind != nil {\n\t\treturn mount.Mount{}, errors.New(\"bind options are incompatible with type tmpfs\")\n\t}","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/compose/convert/volume.go#L118-L154","documentation":"Returned by handleBindToMount (cli/compose/convert/volume.go:135-136). Cluster options are for Swarm cluster volumes; they have no meaning for a host bind mount, so the converter rejects the pairing at cli/compose/convert/volume.go:136. Because ClusterOpts is an empty struct, even `cluster: {}` triggers it.","triggerScenarios":"ServiceVolumeConfig with Type==\"bind\" and Cluster!=nil passed to convertVolumeToMount().","commonSituations":"Migrating a cluster volume to a bind without dropping the `cluster:` key; YAML anchors injecting the field.","solutions":["Remove the `cluster:` key from the bind entry.","If a Swarm cluster volume was intended, change `type:` to `cluster`, remove `bind:`/`image:`/`tmpfs:` blocks, and ensure a non-empty source."],"exampleFix":"# before\nvolumes:\n  - type: bind\n    source: /host/data\n    target: /data\n    cluster: {}\n\n# after\nvolumes:\n  - type: bind\n    source: /host/data\n    target: /data","handlingStrategy":"validation","validationCode":"for i, v := range serviceVolumes {\n    if v.Type == \"bind\" && v.Cluster != nil {\n        return fmt.Errorf(\"service volume[%d] target=%q: type bind must not declare a cluster block\", i, v.Target)\n    }\n}","typeGuard":null,"tryCatchPattern":"mounts, err := convert.Volumes(serviceVolumes, stackVolumes, namespace)\nif err != nil && strings.Contains(err.Error(), \"cluster options are incompatible with type bind\") {\n    return fmt.Errorf(\"compose config error: %w (remove the cluster: block from the bind entry)\", err)\n}","preventionTips":["Cluster volumes are Swarm-only; do not mix cluster blocks with non-cluster types.","Avoid YAML anchors that spread a cluster block across entries of other types."],"tags":["docker","compose","volumes","bind-mount","cluster-volume","config-validation"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}