docker/cli · error
tmpfs options are incompatible with type cluster
Error message
tmpfs options are incompatible with type cluster
What it means
Returned by handleClusterToMount (cli/compose/convert/volume.go:203-204). tmpfs options (size) describe an in-memory filesystem and are meaningless for a Swarm cluster volume, so the converter rejects a `tmpfs:` block on a cluster entry. (The handler accepts its own `cluster:` block and does not check `image:`; it explicitly forbids tmpfs, bind, and volume.)
Solutions
- Delete the `tmpfs:` options block from the cluster entry.
- If a size-capped in-memory filesystem was intended, change `type:` to `tmpfs` (no source).
Example fix
# before
volumes:
- type: cluster
source: my-cluster-vol
target: /data
tmpfs:
size: 67108864
# 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.Tmpfs != nil {
return fmt.Errorf("service volume[%d] target=%q: type cluster must not declare a tmpfs block", i, v.Target)
}
} Try / catch
mounts, err := convert.Volumes(serviceVolumes, stackVolumes, namespace)
if err != nil && strings.Contains(err.Error(), "tmpfs options are incompatible with type cluster") {
return fmt.Errorf("compose config error: %w (remove the tmpfs: block from the cluster entry)", err)
} Prevention
- Cluster volumes are persistent Swarm storage; tmpfs options never apply.
- Strip tmpfs blocks when converting a tmpfs entry into a cluster volume.
When it happens
Trigger: ServiceVolumeConfig with Type=="cluster" and Tmpfs!=nil passed to convertVolumeToMount().
Common situations: Converting a tmpfs entry to a cluster volume without removing the `tmpfs:` block; YAML anchors merging tmpfs options.
Related errors
- cluster options are incompatible with type tmpfs
- cluster options are incompatible with type image
- tmpfs options are incompatible with type bind
- cluster options are incompatible with type bind
- invalid tmpfs source, source must be empty
AI-assisted analysis of docker/cli@4f84911bfe (2026-08-07).
Data as JSON: /api/errors/4ca9d2f6fa701630.
Report an issue: GitHub.
Appendix: source
Thrown at cli/compose/convert/volume.go:204
}
if volume.Bind != nil {
result.BindOptions = &mount.BindOptions{
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 {View on GitHub (pinned to 4f84911bfe)