{"id":"40fe6fb457d40177","repo":"docker/cli","slug":"image-options-are-incompatible-with-type-bind","errorCode":null,"errorMessage":"image options are incompatible with type bind","messagePattern":"image options are incompatible with type bind","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/convert/volume.go","lineNumber":130,"sourceCode":"\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}\n\treturn result, nil\n}\n\nfunc handleTmpfsToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {\n\tresult := createMountFromVolume(volume)\n","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/compose/convert/volume.go#L112-L148","documentation":"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.","triggerScenarios":"'docker stack deploy' with a service volume entry combining type: bind and an image: sub-mapping such as image: {subpath: etc}.","commonSituations":"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.","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."],"exampleFix":"# before\nvolumes:\n  - type: bind\n    source: /srv/data\n    target: /data\n    image:\n      subpath: etc\n# after\nvolumes:\n  - type: bind\n    source: /srv/data\n    target: /data","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker","compose","bind","image-mount","config-validation"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}