docker / docker/cli

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

Open
#5,466 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/ux kind/feature status/0-triage
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

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 ✨

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in cli/command/container/opts.go at the flag definitions for --rm and --entrypoint, as linked in the issue. Check how existing short options are registered and whether r or E conflicts with other docker run options. Done means both aliases work in the shown commands and are represented correctly in the run command's usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.