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
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;
docker psdocker hostsdocker imagesls)docker links listdocker volumes lsdocker rm (id)docker device remove (id)docker rmi (id)docker links remove (id)docker volumes rm (id)docker createdocker device adddocker hosts createrunis proposed as alternativedocker links adddocker volumes addlsandlistsubcommands could be omitted dropped forvolumesandlinksto be in line with the existingimagescommand.docker createcommand (not sure, I actually like "add")devicetodevices?)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