docker/cli ยท error
bind options are incompatible with type image
Error message
bind options are incompatible with type image
What it means
Raised by handleImageToMount when a mount of type 'image' also includes a 'bind:' options block. Bind options like propagation apply only to host-path bind mounts, so the converter fails fast on the incompatible combination.
Source
Thrown at cli/compose/convert/volume.go:104
Name: stackVolume.Driver,
Options: stackVolume.DriverOpts,
}
}
return result, nil
}
func handleImageToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {
result := createMountFromVolume(volume)
if volume.Source == "" {
return mount.Mount{}, errors.New("invalid image source, source cannot be empty")
}
if volume.Volume != nil {
return mount.Mount{}, errors.New("volume options are incompatible with type image")
}
if volume.Bind != nil {
return mount.Mount{}, errors.New("bind options are incompatible with type image")
}
if volume.Tmpfs != nil {
return mount.Mount{}, errors.New("tmpfs options are incompatible with type image")
}
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)
View on GitHub (pinned to e9452d6e78)
Solutions
- Remove the 'bind:' block from the image mount entry.
- If a host-path mount was intended, use type: bind with a filesystem path as source instead of an image reference.
Example fix
# before
volumes:
- type: image
source: alpine:latest
target: /mnt/img
bind:
propagation: rprivate
# after
volumes:
- type: image
source: alpine:latest
target: /mnt/img When it happens
Trigger: 'docker stack deploy' with a service volume entry having type: image plus bind: options (e.g. bind: {propagation: rprivate}).
Common situations: Copying a bind-mount entry as a template for an image mount and only changing type and source; YAML anchors merging bind defaults into every mount entry.
Related errors
- image options are incompatible with type bind
- 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/31aeb455aebdff19.json.
Report an issue: GitHub.