docker/cli ยท error

cluster options are incompatible with type image

Error message

cluster options are incompatible with type image

What it means

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.

Source

Thrown at cli/compose/convert/volume.go:110

}

func handleImageToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {
	result := createMountFromVolume(volume)

	if volume.Source == "" {
		return mount.Mount{}, errors.New("invalid image source, source cannot be empty")
	}
	if volume.Volume != nil {
		return mount.Mount{}, errors.New("volume options are incompatible with type image")
	}
	if volume.Bind != nil {
		return mount.Mount{}, errors.New("bind options are incompatible with type image")
	}
	if volume.Tmpfs != nil {
		return mount.Mount{}, errors.New("tmpfs options are incompatible with type image")
	}
	if volume.Cluster != nil {
		return mount.Mount{}, errors.New("cluster options are incompatible with type image")
	}
	if volume.Image != nil {
		result.ImageOptions = &mount.ImageOptions{
			Subpath: volume.Image.Subpath,
		}
	}
	return result, nil
}

func handleBindToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {
	result := createMountFromVolume(volume)

	if volume.Source == "" {
		return mount.Mount{}, errors.New("invalid bind source, source cannot be empty")
	}
	if volume.Volume != nil {
		return mount.Mount{}, errors.New("volume options are incompatible with type bind")
	}

View on GitHub (pinned to e9452d6e78)

Solutions

  1. Remove the 'cluster:' block from the image mount entry.
  2. If a Swarm CSI cluster volume was intended, change type to cluster and set source to the volume (or group:) name.

Example fix

# before
volumes:
  - type: image
    source: alpine:latest
    target: /mnt/img
    cluster: {}
# after
volumes:
  - type: image
    source: alpine:latest
    target: /mnt/img

When it happens

Trigger: 'docker stack deploy' with a service volume entry combining type: image and a cluster: sub-mapping.

Common situations: Mixing up the newer image-mount and cluster-volume features while experimenting; generated compose files emitting spurious option blocks.

Related errors


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/c20c214802040c2f.json. Report an issue: GitHub.