docker/cli · error

bind options are incompatible with type cluster

Error message

bind options are incompatible with type cluster

What it means

Returned by handleClusterToMount (cli/compose/convert/volume.go:206-207). Propagation is a bind-mount concept and does not apply to Swarm cluster volumes, so a `bind:` block on a cluster entry is rejected.

Solutions

  1. Remove the `bind:` options block from the cluster entry.
  2. If propagation was genuinely required, restore `type: bind` with a host path source.

Example fix

# before
volumes:
  - type: cluster
    source: my-cluster-vol
    target: /data
    bind:
      propagation: rshared

# after
volumes:
  - type: cluster
    source: my-cluster-vol
    target: /data
Defensive patterns

Strategy: validation

Validate before calling

for i, v := range serviceVolumes {
    if v.Type == "cluster" && v.Bind != nil {
        return fmt.Errorf("service volume[%d] target=%q: type cluster must not declare a bind block", i, v.Target)
    }
}

Try / catch

mounts, err := convert.Volumes(serviceVolumes, stackVolumes, namespace)
if err != nil && strings.Contains(err.Error(), "bind options are incompatible with type cluster") {
    return fmt.Errorf("compose config error: %w (remove the bind: block from the cluster entry)", err)
}

Prevention

When it happens

Trigger: ServiceVolumeConfig with Type=="cluster" and Bind!=nil passed to convertVolumeToMount().

Common situations: Migrating a bind entry to a cluster volume without stripping the `bind: { propagation: ... }` block; YAML merge pulling in bind options.

Related errors


AI-assisted analysis of docker/cli@4f84911bfe (2026-08-07). Data as JSON: /api/errors/d290e8c5cf914390. Report an issue: GitHub.

Appendix: source

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

			Propagation: mount.Propagation(volume.Bind.Propagation),
		}
	}
	return result, nil
}

func handleClusterToMount(
	volume composetypes.ServiceVolumeConfig,
	stackVolumes volumes,
	namespace Namespace,
) (mount.Mount, error) {
	if volume.Source == "" {
		return mount.Mount{}, errors.New("invalid cluster source, source cannot be empty")
	}
	if volume.Tmpfs != nil {
		return mount.Mount{}, errors.New("tmpfs options are incompatible with type cluster")
	}
	if volume.Bind != nil {
		return mount.Mount{}, errors.New("bind options are incompatible with type cluster")
	}
	if volume.Volume != nil {
		return mount.Mount{}, errors.New("volume options are incompatible with type cluster")
	}

	result := createMountFromVolume(volume)
	result.ClusterOptions = &mount.ClusterOptions{}

	if !strings.HasPrefix(volume.Source, "group:") {
		// if the volume is a cluster volume and the source is a volumegroup, we
		// will ignore checking to see if such a volume is defined. the volume
		// group isn't namespaced, and there's no simple way to indicate that
		// external volumes with a given group exist.
		stackVolume, exists := stackVolumes[volume.Source]
		if !exists {
			return mount.Mount{}, fmt.Errorf("undefined volume %q", volume.Source)
		}

View on GitHub (pinned to 4f84911bfe)