{"id":"702002ad3e45dc3a","repo":"docker/cli","slug":"cluster-options-are-incompatible-with-type-volume","errorCode":null,"errorMessage":"cluster options are incompatible with type volume","messagePattern":"cluster options are incompatible with type volume","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/convert/volume.go","lineNumber":54,"sourceCode":"\nfunc handleVolumeToMount(\n\tvolume composetypes.ServiceVolumeConfig,\n\tstackVolumes volumes,\n\tnamespace Namespace,\n) (mount.Mount, error) {\n\tresult := createMountFromVolume(volume)\n\n\tif volume.Image != nil {\n\t\treturn mount.Mount{}, errors.New(\"images options are incompatible with type volume\")\n\t}\n\tif volume.Tmpfs != nil {\n\t\treturn mount.Mount{}, errors.New(\"tmpfs options are incompatible with type volume\")\n\t}\n\tif volume.Bind != nil {\n\t\treturn mount.Mount{}, errors.New(\"bind options are incompatible with type volume\")\n\t}\n\tif volume.Cluster != nil {\n\t\treturn mount.Mount{}, errors.New(\"cluster options are incompatible with type volume\")\n\t}\n\t// Anonymous volumes\n\tif volume.Source == \"\" {\n\t\treturn result, nil\n\t}\n\n\tstackVolume, exists := stackVolumes[volume.Source]\n\tif !exists {\n\t\treturn mount.Mount{}, fmt.Errorf(\"undefined volume %q\", volume.Source)\n\t}\n\n\tresult.Source = namespace.Scope(volume.Source)\n\tresult.VolumeOptions = &mount.VolumeOptions{}\n\n\tif volume.Volume != nil {\n\t\tresult.VolumeOptions.NoCopy = volume.Volume.NoCopy\n\t\tresult.VolumeOptions.Subpath = volume.Volume.Subpath\n\t}","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/compose/convert/volume.go#L36-L72","documentation":"Raised by handleVolumeToMount when a mount of type 'volume' (or defaulted empty type) also specifies a 'cluster:' options block. Cluster options belong exclusively to Swarm CSI cluster volumes (type: cluster); the converter rejects the mix so the engine never receives contradictory mount option structs.","triggerScenarios":"'docker stack deploy' with a compose service volume entry having type: volume (or no type) plus a cluster: sub-mapping.","commonSituations":"Migrating a named volume to a Swarm CSI cluster volume and adding cluster options without changing the type; YAML merge keys spreading cluster options across entries.","solutions":["Change 'type: volume' to 'type: cluster' if you intend a Swarm CSI cluster volume, or delete the 'cluster:' block.","Verify with 'docker compose config' that each mount entry carries only options matching its type."],"exampleFix":"# before\nvolumes:\n  - type: volume\n    source: shared\n    target: /data\n    cluster: {}\n# after\nvolumes:\n  - type: cluster\n    source: shared\n    target: /data","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker","compose","volume","cluster-volume","swarm","config-validation"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}