{"id":"c20c214802040c2f","repo":"docker/cli","slug":"cluster-options-are-incompatible-with-type-image","errorCode":null,"errorMessage":"cluster options are incompatible with type image","messagePattern":"cluster options are incompatible with type image","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/convert/volume.go","lineNumber":110,"sourceCode":"}\n\nfunc handleImageToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {\n\tresult := createMountFromVolume(volume)\n\n\tif volume.Source == \"\" {\n\t\treturn mount.Mount{}, errors.New(\"invalid image 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 image\")\n\t}\n\tif volume.Bind != nil {\n\t\treturn mount.Mount{}, errors.New(\"bind options are incompatible with type image\")\n\t}\n\tif volume.Tmpfs != nil {\n\t\treturn mount.Mount{}, errors.New(\"tmpfs options are incompatible with type image\")\n\t}\n\tif volume.Cluster != nil {\n\t\treturn mount.Mount{}, errors.New(\"cluster options are incompatible with type image\")\n\t}\n\tif volume.Image != nil {\n\t\tresult.ImageOptions = &mount.ImageOptions{\n\t\t\tSubpath: volume.Image.Subpath,\n\t\t}\n\t}\n\treturn result, nil\n}\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}","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/compose/convert/volume.go#L92-L128","documentation":"Raised by handleImageToMount when a mount of type 'image' also specifies a 'cluster:' options block. Cluster options are exclusive to Swarm CSI cluster volumes (type: cluster), so the converter rejects them on image mounts.","triggerScenarios":"'docker stack deploy' with a service volume entry combining type: image and a cluster: sub-mapping.","commonSituations":"Mixing up the newer image-mount and cluster-volume features while experimenting; generated compose files emitting spurious option blocks.","solutions":["Remove the 'cluster:' block from the image mount entry.","If a Swarm CSI cluster volume was intended, change type to cluster and set source to the volume (or group:) name."],"exampleFix":"# before\nvolumes:\n  - type: image\n    source: alpine:latest\n    target: /mnt/img\n    cluster: {}\n# after\nvolumes:\n  - type: image\n    source: alpine:latest\n    target: /mnt/img","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker","compose","image-mount","cluster-volume","config-validation"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}