docker/cli ยท error
volume options are incompatible with type bind
Error message
volume options are incompatible with type bind
What it means
Raised by handleBindToMount when a mount of type 'bind' also carries a 'volume:' options block (nocopy/subpath). Those options only make sense for named volumes, so the converter rejects the mixed entry rather than silently ignoring them.
Source
Thrown at cli/compose/convert/volume.go:127
if volume.Cluster != nil {
return mount.Mount{}, errors.New("cluster options are incompatible with type image")
}
if volume.Image != nil {
result.ImageOptions = &mount.ImageOptions{
Subpath: volume.Image.Subpath,
}
}
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
}
View on GitHub (pinned to e9452d6e78)
Solutions
- Remove the 'volume:' block from the bind entry; for a subdirectory of the host path, just extend the source path itself.
- If named-volume semantics (nocopy, subpath) are needed, change type back to volume and define the volume in the top-level volumes section.
Example fix
# before
volumes:
- type: bind
source: /srv/data
target: /data
volume:
nocopy: true
# after
volumes:
- type: bind
source: /srv/data
target: /data When it happens
Trigger: 'docker stack deploy' with a service volume entry combining type: bind and volume: options such as volume: {nocopy: true}.
Common situations: Switching a named-volume entry to a host bind mount and forgetting to delete the volume: block; YAML anchors applying volume defaults to every mount.
Related errors
- bind options are incompatible with type volume
- cluster options are incompatible with type volume
- volume options are incompatible with type image
- bind options are incompatible with type image
- invalid bind source, source cannot be empty
AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01).
Data as JSON: /data/errors/f4ce5a483d23dcbf.json.
Report an issue: GitHub.