docker/cli · error
conflicting options: cannot specify a volume-name through bo
Error message
conflicting options: cannot specify a volume-name through both --name and as a positional arg
What it means
Raised by `docker volume create` when a volume name is supplied both as the positional argument and via the --name flag. Since both set the same field, the CLI refuses the ambiguous invocation rather than silently picking one.
Source
Thrown at cli/command/volume/create.go:58
}
func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
options := createOptions{
driverOpts: *opts.NewMapOpts(nil, nil),
labels: opts.NewListOpts(opts.ValidateLabel),
secrets: *opts.NewMapOpts(nil, nil),
requisiteTopology: opts.NewListOpts(nil),
preferredTopology: opts.NewListOpts(nil),
}
cmd := &cobra.Command{
Use: "create [OPTIONS] [VOLUME]",
Short: "Create a volume",
Args: cli.RequiresMaxArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 1 {
if options.name != "" {
return errors.New("conflicting options: cannot specify a volume-name through both --name and as a positional arg")
}
options.name = args[0]
}
options.cluster = hasClusterVolumeOptionSet(cmd.Flags())
return runCreate(cmd.Context(), dockerCLI, options)
},
ValidArgsFunction: cobra.NoFileCompletions,
DisableFlagsInUseLine: true,
}
flags := cmd.Flags()
flags.StringVarP(&options.driver, "driver", "d", "local", "Specify volume driver name")
flags.StringVar(&options.name, "name", "", "Specify volume name")
flags.Lookup("name").Hidden = true
flags.VarP(&options.driverOpts, "opt", "o", "Set driver specific options")
flags.Var(&options.labels, "label", "Set metadata for a volume")
// flags for cluster volumes only
flags.StringVar(&options.group, "group", "", "Cluster Volume group (cluster volumes)")View on GitHub (pinned to e9452d6e78)
Solutions
- Pass the name only once, preferably positionally: `docker volume create foo`.
- Remove the deprecated-style --name flag from scripts, or drop the positional arg if you keep --name.
Example fix
# before docker volume create --name mydata mydata # after docker volume create mydata
When it happens
Trigger: `docker volume create --name foo bar` — cobra RunE sees len(args)==1 and options.name != "" at cli/command/volume/create.go:58.
Common situations: Scripts migrated from very old Docker versions where --name was the documented way, later edited to also pass a positional name; wrapper tooling that appends a positional arg while users also set --name.
Related errors
- conflicting options: cannot specify both --all and --filter
- images options are incompatible with type volume
- plugin candidate path cannot be empty
- plugin SchemaVersion version cannot be empty
- config file is required
AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01).
Data as JSON: /data/errors/cf5b31bee5c47736.json.
Report an issue: GitHub.