{"id":"3a8eddc5e9f78c7b","repo":"docker/cli","slug":"bind-options-are-incompatible-with-type-volume","errorCode":null,"errorMessage":"bind options are incompatible with type volume","messagePattern":"bind options are incompatible with type volume","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/convert/volume.go","lineNumber":51,"sourceCode":"\t\tConsistency: mount.Consistency(volume.Consistency),\n\t}\n}\n\nfunc handleVolumeToMount(\n\tvolume composetypes.ServiceVolumeConfig,\n\tstackVolumes volumes,\n\tnamespace Namespace,\n) (mount.Mount, error) {\n\tresult := createMountFromVolume(volume)\n\n\tif volume.Image != nil {\n\t\treturn mount.Mount{}, errors.New(\"images options are incompatible with type volume\")\n\t}\n\tif volume.Tmpfs != nil {\n\t\treturn mount.Mount{}, errors.New(\"tmpfs options are incompatible with type volume\")\n\t}\n\tif volume.Bind != nil {\n\t\treturn mount.Mount{}, errors.New(\"bind options are incompatible with type volume\")\n\t}\n\tif volume.Cluster != nil {\n\t\treturn mount.Mount{}, errors.New(\"cluster options are incompatible with type volume\")\n\t}\n\t// Anonymous volumes\n\tif volume.Source == \"\" {\n\t\treturn result, nil\n\t}\n\n\tstackVolume, exists := stackVolumes[volume.Source]\n\tif !exists {\n\t\treturn mount.Mount{}, fmt.Errorf(\"undefined volume %q\", volume.Source)\n\t}\n\n\tresult.Source = namespace.Scope(volume.Source)\n\tresult.VolumeOptions = &mount.VolumeOptions{}\n\n\tif volume.Volume != nil {","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/compose/convert/volume.go#L33-L69","documentation":"Raised by handleVolumeToMount in the docker CLI's compose-to-swarm converter when a service volume entry whose type resolves to 'volume' (or an empty type, which defaults to 'volume') also carries a 'bind:' options block. Each mount type accepts only its own option struct, so the converter fails fast rather than silently ignoring bind options (like propagation) that the engine would never apply to a named volume mount.","triggerScenarios":"Running 'docker stack deploy' (or any caller of convert.Volumes) with a compose file where a service's long-form volume entry has type: volume (or omits type) but includes a bind: sub-mapping, e.g. bind: {propagation: rshared}.","commonSituations":"Copy-pasting a bind-mount entry and changing only the type field; editing type: bind to type: volume without removing the bind options; templating/YAML anchors merging bind options into all volume entries.","solutions":["Remove the 'bind:' block from the volume entry, or change 'type: volume' to 'type: bind' if a host-path bind mount was intended.","If you need propagation settings, use type: bind with a host path source; named volumes do not support bind propagation.","Validate the file with 'docker compose config' before deploying."],"exampleFix":"# before\nvolumes:\n  - type: volume\n    source: data\n    target: /data\n    bind:\n      propagation: rshared\n# after\nvolumes:\n  - type: volume\n    source: data\n    target: /data","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker","compose","volume","config-validation","swarm"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}