docker/cli ยท error
tmpfs options are incompatible with type bind
Error message
tmpfs options are incompatible with type bind
What it means
Raised by handleBindToMount in docker/cli's compose converter (used by `docker stack deploy`) when a service volume declared as `type: bind` also carries a `tmpfs:` options block. Each mount type in the long volume syntax accepts only its own options struct, and the converter rejects any foreign options block outright rather than silently ignoring it.
Source
Thrown at cli/compose/convert/volume.go:133
}
}
return result, nil
}
func handleBindToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {
result := createMountFromVolume(volume)
if volume.Source == "" {
return mount.Mount{}, errors.New("invalid bind source, source cannot be empty")
}
if volume.Volume != nil {
return mount.Mount{}, errors.New("volume options are incompatible with type bind")
}
if volume.Image != nil {
return mount.Mount{}, errors.New("image options are incompatible with type bind")
}
if volume.Tmpfs != nil {
return mount.Mount{}, errors.New("tmpfs options are incompatible with type bind")
}
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")
}View on GitHub (pinned to e9452d6e78)
Solutions
- Remove the `tmpfs:` block from the bind-mount volume entry in the compose file
- If tmpfs behavior was intended, change `type: bind` to `type: tmpfs` and drop the `source:` field
- If both are needed, split into two separate volume entries, one bind and one tmpfs
Example fix
# before
volumes:
- type: bind
source: /host/data
target: /data
tmpfs:
size: 10000000
# after
volumes:
- type: bind
source: /host/data
target: /data When it happens
Trigger: A compose file service volume with `type: bind` that also sets `tmpfs.size` (volume.Tmpfs != nil after parsing), passed through convert.Service/convertServiceVolumes during `docker stack deploy` or any code calling handleBindToMount.
Common situations: Copy-pasting a tmpfs volume entry and changing only `type` to bind; YAML indentation placing a tmpfs block under the wrong volume entry; templating/anchors merging option blocks from another mount definition.
Related errors
- cluster options are incompatible with type bind
- bind options are incompatible with type tmpfs
- invalid tmpfs source, source must be empty
- volume options are incompatible with type tmpfs
- image options are incompatible with type tmpfs
AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01).
Data as JSON: /data/errors/b5e142a5617d5124.json.
Report an issue: GitHub.