Skip to content

Plugins can't re-use the same flags as cli global flags #1699

@silvin-lubecki

Description

@silvin-lubecki

Description
A plugin can't use the same name as one of the cli global flags (debug, log-level, context, ...), or worse can't use the same shortcut (ex: -c).

If I add a new flag to the hello-world plugin like this following:

flags.StringVarP(&compose, "compose", "c", "", "compose file")

and try to use it:

$ docker helloworld -c my-compose-file.yml
unable to resolve docker endpoint: context "my-compose-file.yml" does not exist

$ docker --help
...
  -c, --context string     Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with "docker context use")

This context flag is a root command flag, not a PersistentFlag and so shouldn't be used by the docker cli and forwarded directly to the plugin.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions