Skip to content

Preserve / improve consistency in CLI UX: use docker <object> <verb> #8829

@thaJeztah

Description

@thaJeztah

Summary:
There is no standardised "naming" for (sub)commands on the CLI (e.g. plural vs singular, create vs add), sometimes leading to inconsistencies.

Proposed solution:
A design document should be written, describing the (naming) conventions to follow for commands and the UX in general.


A number of new features are currently proposed via PRs for addition to Docker. These features add new commands to the CLI and I have noticed that the UI for those commands (and existing commands) is inconsistent.

While there still a chance to change those proposals before they are merged, I think it would be a good thing to review those PRs and reach consensus on what the UI should look like to be consistent.

I've created a (far from complete) overview of some existing and proposed commands;

Entity Action Command Notes
Container list docker ps
Device list - (not supported)
Host list docker hosts no sub command. see #8681
Image list docker images no sub command (ls)
Links list docker links list see #7468
Volume list docker volumes ls see #8484
Container delete docker rm (id)
Device delete docker device remove (id) see #8826
Host delete - (not supported?)
Image delete docker rmi (id)
Links delete docker links remove (id)
Volume delete docker volumes rm (id)
Container create docker create no "containers" before "create"
Device create docker device add note: singular "device", others are "plural"
Host create docker hosts create run is proposed as alternative
Link create docker links add
Volume create docker volumes add
  • The ls and list subcommands could be omitted dropped for volumes and links to be in line with the existing images command.
  • The subcommand for "delete" should either be "remove" or "rm" for all entities.
  • The subcommand for "create" could be renamed from "add" to "create" to be in line with the existing docker create command (not sure, I actually like "add")
  • All entities / top-level commands should be either plural or singular (rename device to devices?)

Now that the "links" (#7468), "volumes" (#8484), "hosts" (#8681) and "devices" (#8826) changes are still a proposal, I think the creators those proposals should discuss a consistent UI before they're implemented to keep things consistent.

For the existing commands I understand that most frequently used commands are deliberately left short for convenience, perhaps "long" versions (docker images rm?) could be added to make the UI more consistent.

(This is a follow up on a comment I placed here #8484 (comment))

update
Added the "hosts" proposal to the list and sorted the list a bit

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cliClientarea/docskind/featureFunctionality or other elements that the project doesn't currently have. Features are new and shiny

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions