docker/cli ยท error
image options are incompatible with type bind
Error message
image options are incompatible with type bind
What it means
Raised by handleBindToMount when a mount of type 'bind' also includes an 'image:' options block. Image options (subpath into a mounted image) apply only to type: image mounts, so the converter fails fast on the incompatible pairing.
Source
Thrown at cli/compose/convert/volume.go:130
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
}
func handleTmpfsToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {
result := createMountFromVolume(volume)
View on GitHub (pinned to e9452d6e78)
Solutions
- Remove the 'image:' block from the bind entry; to mount a subdirectory of the host, put it directly in the source path.
- If mounting an image's filesystem was intended, change type to image and make source an image reference.
Example fix
# before
volumes:
- type: bind
source: /srv/data
target: /data
image:
subpath: etc
# 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 an image: sub-mapping such as image: {subpath: etc}.
Common situations: Converting an image mount to a host bind mount and leaving the image: block behind; tooling that emits every option block regardless of mount type.
Related errors
- bind options are incompatible with type image
- invalid image source, source cannot be empty
- volume options are incompatible with type image
- tmpfs options are incompatible with type image
- cluster options are incompatible with type image
AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01).
Data as JSON: /data/errors/40fe6fb457d40177.json.
Report an issue: GitHub.