{"id":"156c6136cbf05081","repo":"docker/cli","slug":"invalid-bind-source-source-cannot-be-empty","errorCode":null,"errorMessage":"invalid bind source, source cannot be empty","messagePattern":"invalid bind source, source cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/convert/volume.go","lineNumber":124,"sourceCode":"\tif volume.Tmpfs != nil {\n\t\treturn mount.Mount{}, errors.New(\"tmpfs options are incompatible with type image\")\n\t}\n\tif volume.Cluster != nil {\n\t\treturn mount.Mount{}, errors.New(\"cluster options are incompatible with type image\")\n\t}\n\tif volume.Image != nil {\n\t\tresult.ImageOptions = &mount.ImageOptions{\n\t\t\tSubpath: volume.Image.Subpath,\n\t\t}\n\t}\n\treturn result, nil\n}\n\nfunc handleBindToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {\n\tresult := createMountFromVolume(volume)\n\n\tif volume.Source == \"\" {\n\t\treturn mount.Mount{}, errors.New(\"invalid bind source, source cannot be empty\")\n\t}\n\tif volume.Volume != nil {\n\t\treturn mount.Mount{}, errors.New(\"volume options are incompatible with type bind\")\n\t}\n\tif volume.Image != nil {\n\t\treturn mount.Mount{}, errors.New(\"image options are incompatible with type bind\")\n\t}\n\tif volume.Tmpfs != nil {\n\t\treturn mount.Mount{}, errors.New(\"tmpfs options are incompatible with type bind\")\n\t}\n\tif volume.Cluster != nil {\n\t\treturn mount.Mount{}, errors.New(\"cluster options are incompatible with type bind\")\n\t}\n\tif volume.Bind != nil {\n\t\tresult.BindOptions = &mount.BindOptions{\n\t\t\tPropagation: mount.Propagation(volume.Bind.Propagation),\n\t\t}\n\t}","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/compose/convert/volume.go#L106-L142","documentation":"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.","triggerScenarios":"'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.","commonSituations":"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.","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."],"exampleFix":"# before\nvolumes:\n  - type: bind\n    target: /app/config\n# after\nvolumes:\n  - type: bind\n    source: /srv/app/config\n    target: /app/config","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker","compose","bind","config-validation","env-substitution"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}