docker/cli · error
volume options are incompatible with type tmpfs
Error message
volume options are incompatible with type tmpfs
What it means
Returned by handleTmpfsToMount (cli/compose/convert/volume.go:155-156). nocopy/subpath are named-volume options and have no analogue for an in-memory tmpfs filesystem, so the converter rejects a `volume:` block on a tmpfs entry.
Solutions
- Remove the `volume:` options block from the tmpfs entry.
- If nocopy/subpath was required, restore `type: volume` and reference a named source.
Example fix
# before
volumes:
- type: tmpfs
target: /cache
volume:
nocopy: true
# after
volumes:
- type: tmpfs
target: /cache Defensive patterns
Strategy: validation
Validate before calling
for i, v := range serviceVolumes {
if v.Type == "tmpfs" && v.Volume != nil {
return fmt.Errorf("service volume[%d] target=%q: type tmpfs must not declare a volume block", i, v.Target)
}
} Try / catch
mounts, err := convert.Volumes(serviceVolumes, stackVolumes, namespace)
if err != nil && strings.Contains(err.Error(), "volume options are incompatible with type tmpfs") {
return fmt.Errorf("compose config error: %w (remove the volume: block from the tmpfs entry)", err)
} Prevention
- Do not derive a tmpfs entry from a named-volume template without deleting the volume block.
- Run `docker compose config` to surface cross-type option conflicts.
When it happens
Trigger: ServiceVolumeConfig with Type=="tmpfs" and Volume!=nil passed to convertVolumeToMount().
Common situations: Reusing a named-volume entry and flipping its type to tmpfs; copy-paste between volume definitions.
Related errors
- volume options are incompatible with type bind
- tmpfs options are incompatible with type bind
- invalid tmpfs source, source must be empty
- bind options are incompatible with type tmpfs
- image options are incompatible with type tmpfs
AI-assisted analysis of docker/cli@4f84911bfe (2026-08-07).
Data as JSON: /api/errors/058b060842230a99.
Report an issue: GitHub.
Appendix: source
Thrown at cli/compose/convert/volume.go:156
if volume.Bind != nil {
result.BindOptions = &mount.BindOptions{
Propagation: mount.Propagation(volume.Bind.Propagation),
}
}
return result, nil
}
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)
View on GitHub (pinned to 4f84911bfe)