docker/cli · error
cluster options are incompatible with type tmpfs
Error message
cluster options are incompatible with type tmpfs
What it means
Returned by handleTmpfsToMount (cli/compose/convert/volume.go:161-162). Cluster options describe Swarm cluster volumes and are meaningless for a local in-memory tmpfs; the converter rejects the combination. ClusterOpts is empty, so `cluster:` or `cluster: {}` both trip it.
Solutions
- Remove the `cluster:` key from the tmpfs entry.
- If a Swarm cluster volume was intended, change `type:` to `cluster`, drop `tmpfs:`/`bind:`/`volume:`/`image:` blocks, and set a non-empty source.
Example fix
# before
volumes:
- type: tmpfs
target: /cache
cluster: {}
# after
volumes:
- type: tmpfs
target: /cache Defensive patterns
Strategy: validation
Validate before calling
for i, v := range serviceVolumes {
if v.Type == "tmpfs" && v.Cluster != nil {
return fmt.Errorf("service volume[%d] target=%q: type tmpfs must not declare a cluster block", i, v.Target)
}
} Try / catch
mounts, err := convert.Volumes(serviceVolumes, stackVolumes, namespace)
if err != nil && strings.Contains(err.Error(), "cluster options are incompatible with type tmpfs") {
return fmt.Errorf("compose config error: %w (remove the cluster: block from the tmpfs entry)", err)
} Prevention
- tmpfs is local and in-memory; cluster options are Swarm-only and never combine.
- Beware empty `cluster: {}` — the pointer is non-nil and still trips the guard.
When it happens
Trigger: ServiceVolumeConfig with Type=="tmpfs" and Cluster!=nil passed to convertVolumeToMount().
Common situations: Migrating a cluster volume entry to tmpfs without stripping the `cluster:` key; YAML anchors injecting the field.
Related errors
- tmpfs options are incompatible with type cluster
- 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/335e54356fe05a2e.
Report an issue: GitHub.
Appendix: source
Thrown at cli/compose/convert/volume.go:162
}
func handleTmpfsToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {
result := createMountFromVolume(volume)
if volume.Source != "" {
return mount.Mount{}, errors.New("invalid tmpfs source, source must be empty")
}
if volume.Bind != nil {
return mount.Mount{}, errors.New("bind options are incompatible with type tmpfs")
}
if volume.Volume != nil {
return mount.Mount{}, errors.New("volume options are incompatible with type tmpfs")
}
if volume.Image != nil {
return mount.Mount{}, errors.New("image options are incompatible with type tmpfs")
}
if volume.Cluster != nil {
return mount.Mount{}, errors.New("cluster options are incompatible with type tmpfs")
}
if volume.Tmpfs != nil {
result.TmpfsOptions = &mount.TmpfsOptions{
SizeBytes: volume.Tmpfs.Size,
}
}
return result, nil
}
func handleNpipeToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {
result := createMountFromVolume(volume)
if volume.Source == "" {
return mount.Mount{}, errors.New("invalid npipe source, source cannot be empty")
}
if volume.Volume != nil {
return mount.Mount{}, errors.New("volume options are incompatible with type npipe")
}View on GitHub (pinned to 4f84911bfe)