{"id":"31aeb455aebdff19","repo":"docker/cli","slug":"bind-options-are-incompatible-with-type-image","errorCode":null,"errorMessage":"bind options are incompatible with type image","messagePattern":"bind options are incompatible with type image","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/convert/volume.go","lineNumber":104,"sourceCode":"\t\t\tName:    stackVolume.Driver,\n\t\t\tOptions: stackVolume.DriverOpts,\n\t\t}\n\t}\n\n\treturn result, nil\n}\n\nfunc handleImageToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {\n\tresult := createMountFromVolume(volume)\n\n\tif volume.Source == \"\" {\n\t\treturn mount.Mount{}, errors.New(\"invalid image 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 image\")\n\t}\n\tif volume.Bind != nil {\n\t\treturn mount.Mount{}, errors.New(\"bind options are incompatible with type image\")\n\t}\n\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","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/compose/convert/volume.go#L86-L122","documentation":"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.","triggerScenarios":"'docker stack deploy' with a service volume entry having type: image plus bind: options (e.g. bind: {propagation: rprivate}).","commonSituations":"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.","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."],"exampleFix":"# before\nvolumes:\n  - type: image\n    source: alpine:latest\n    target: /mnt/img\n    bind:\n      propagation: rprivate\n# after\nvolumes:\n  - type: image\n    source: alpine:latest\n    target: /mnt/img","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker","compose","image-mount","bind","config-validation"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}