docker/cli · error
bind options are incompatible with type tmpfs
Error message
bind options are incompatible with type tmpfs
What it means
Returned by handleTmpfsToMount (cli/compose/convert/volume.go:152-153). Propagation is a bind-mount concept and is meaningless for an in-memory tmpfs, so a `bind:` block on a tmpfs entry is rejected.
Solutions
- Delete the `bind:` options block from the tmpfs entry.
- If propagation was genuinely needed, the mount is really a bind — restore `type: bind` and supply a host source.
Example fix
# before
volumes:
- type: tmpfs
target: /cache
bind:
propagation: rshared
# after
volumes:
- type: tmpfs
target: /cache Defensive patterns
Strategy: validation
Validate before calling
for i, v := range serviceVolumes {
if v.Type == "tmpfs" && v.Bind != nil {
return fmt.Errorf("service volume[%d] target=%q: type tmpfs 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 tmpfs") {
return fmt.Errorf("compose config error: %w (remove the bind: block from the tmpfs entry)", err)
} Prevention
- Propagation only applies to bind mounts; never carry a bind block onto a tmpfs entry.
- Keep type changes and option-block cleanup in the same commit.
When it happens
Trigger: ServiceVolumeConfig with Type=="tmpfs" and Bind!=nil passed to convertVolumeToMount().
Common situations: Changing a bind entry to tmpfs without removing the `bind: { propagation: ... }` block; YAML merge pulling in bind options.
Related errors
- tmpfs options are incompatible with type bind
- invalid bind source, source cannot be empty
- volume options are incompatible with type bind
- image options are incompatible with type bind
- cluster options are incompatible with type bind
AI-assisted analysis of docker/cli@4f84911bfe (2026-08-07).
Data as JSON: /api/errors/a08a752ff55e1cc3.
Report an issue: GitHub.
Appendix: source
Thrown at cli/compose/convert/volume.go:153
if volume.Cluster != nil {
return mount.Mount{}, errors.New("cluster options are incompatible with type bind")
}
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
}
View on GitHub (pinned to 4f84911bfe)