docker/cli ยท error
invalid bind source, source cannot be empty
Error message
invalid bind source, source cannot be empty
What it means
Raised at the top of handleBindToMount when a mount of type 'bind' has an empty source. A bind mount maps a host path into the container, so the source path is mandatory; unlike type: volume there is no anonymous form, and the converter fails before contacting the engine.
Source
Thrown at cli/compose/convert/volume.go:124
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)
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),
}
}View on GitHub (pinned to e9452d6e78)
Solutions
- Add an absolute host path as source, e.g. source: /srv/app/config.
- If the source uses ${VAR} substitution, set the variable in the deploying shell or .env file and confirm with 'docker compose config'.
- If you actually wanted an anonymous or named volume, change type to volume.
Example fix
# before
volumes:
- type: bind
target: /app/config
# after
volumes:
- type: bind
source: /srv/app/config
target: /app/config When it happens
Trigger: 'docker stack deploy' with a service volume entry of type: bind whose source is missing, empty, or an unset variable like ${HOST_PATH} that substitutes to empty.
Common situations: Undefined environment variables in source paths (very common in CI where the .env file is absent); forgetting source: after switching an entry from type: volume; short-form '- /container/path' entries meant as anonymous volumes but written under type: bind in long form.
Related errors
- bind options are incompatible with type image
- volume options are incompatible with type bind
- image options are incompatible with type bind
- bind options are incompatible with type volume
- cluster options are incompatible with type volume
AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01).
Data as JSON: /data/errors/156c6136cbf05081.json.
Report an issue: GitHub.