cli icon indicating copy to clipboard operation
cli copied to clipboard

Command `run` short CLI options `-r` and `-E` (for `--rm` and `--entrypoint` respectively)

Open serious-angel opened this issue 1 year ago • 0 comments

Description

Dear Developers,

Thank you very much for the ineffably marvelous project... 🪐

Considering the absence of some short options in usage for command run, I just wanted to clarify the rationale behind it except an safety trait or a protection against a mistake of an accidental container removal.


For instance, what if the call would add the short option alias for --rm as the following?:

https://github.com/docker/cli/blob/baa7a9f7ad378204e8d3ca52121271402ed38a66/cli/command/container/opts.go#L211

flags.BoolVar(&copts.autoRemove, "rm", "r", false, "Automatically remove the container and its associated anonymous volumes when it exits")

This, in turn, would allow to shorten it:

$ # docker run -it --rm -- 'debian:bookworm' bash;
$ docker run -rit -- 'debian:bookworm' bash;

Similarly, short option alias -E for --entrypoint:

https://github.com/docker/cli/blob/baa7a9f7ad378204e8d3ca52121271402ed38a66/cli/command/container/opts.go#L194

flags.StringVar(&copts.entrypoint, "entrypoint", "E", "", "Overwrite the default ENTRYPOINT of the image")
$ # docker run -it --rm --entrypoint '/bin/dash' -- 'debian:bookworm';
$ docker run -ritE '/bin/dash' -- 'debian:bookworm';

Would there be some kind of conflict involved if added?

Best and kind regards ✨

serious-angel avatar Sep 21 '24 15:09 serious-angel