Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dnephin
Copy link
Member

@dnephin dnephin commented Aug 25, 2016

Fixes #13509
Fixes #8829
Fixes #8756

  • create a new docker image and docker container command
  • add the image and container commands as subcommands of the new command groups with a few commands renamed:
    • images -> image ls (with aliases)
    • rmi -> image rm (with aliases)
    • ps -> container ls (with aliases)
  • add image inspect and container inspect to match the other command groups
  • add 3-letter allises for all commands groups
    • docker con
    • docker img
    • docker srv
    • docker net
    • docker vol

@icecrime
Copy link
Contributor

Absolutely LGTM on design, 🎉, 💯, etc.

My only nit, but I won't fight for it, is that I'm skeptical about the need for short aliases (docker con, docker vol, etc.).

@nathanleclaire
Copy link
Contributor

docker con

image

@MHBauer
Copy link
Contributor

MHBauer commented Aug 26, 2016

Not big on the short aliases, but I like the thought for everything else.

@vdemeester
Copy link
Member

Not a huge fan of short aliases but other than that, just like @icecrime, absolutely LGTM on design 😎 🎉

@dnephin
Copy link
Member Author

dnephin commented Aug 26, 2016

My rational for the short aliases is this:

It's going to be difficult to convince people to use docker container rm instead of docker rm. It's just much longer to type. Adding the short aliases make the situation a lot better because it's just 3 extra characters, instead of 9!

If we don't make it easy to use the new canonical commands we're never going to be able to remove them.

@cpuguy83
Copy link
Member

You think we'll be able to remove something like docker rm or docker run? I doubt that.

@dnephin
Copy link
Member Author

dnephin commented Aug 26, 2016

docker run no, we aren't even hiding it, it's staying as a permanent alias.

The rest, not any time soon. Maybe in a year or two if we're good about converting all the docs to the new form, and communicating the new canonical way of doing things.

@stevvooe
Copy link
Contributor

I love this, but if we do it, we should take this chance to fix the output of inspect to default to be pretty and composite. This was a HUGE point of contention during the implementation of swarm services. Making inspect output text composed of multiple API calls will address this problem and let us really grow the usability of inspect, while addressing long standing issues.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should carry over search to docker image. We aren't searching the local image store, we are searching remote registries. Future extension to search won't happen under docker image.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. Maybe it belongs with login and logout under another top-level command?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I'll move the search command file to the correct package, and move it back to the top level.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There may be a docker registry command, but that is a whole 'notha can o wyrms!

@icecrime icecrime self-assigned this Aug 28, 2016
@OJFord
Copy link

OJFord commented Aug 28, 2016

My rational for the short aliases is this:
It's going to be difficult to convince people to use docker container rm instead of docker rm. It's just much longer to type.

Realistically people won't do that though, they'll type docker c<tab> rm. As long as the completion is the full "container" (i.e. "con" isn't an entry) it wouldn't bother me, but for this reason I don't think it's necessary.

@dnephin
Copy link
Member Author

dnephin commented Aug 29, 2016

we should take this chance to fix the output of inspect to default to be pretty and composite

I'm not sure that we can change inspect, but we could definitely introduce a new command that defaults to pretty print, and hide inspect from help. Do you know if there is an issue with a proposal for that change? I'd like to keep that discussion and change separate from this PR.

@dnephin dnephin force-pushed the cli-new-command-structure branch from 475948a to d23b413 Compare August 29, 2016 14:04
@nathanleclaire
Copy link
Contributor

Realistically people won't do that though, they'll type docker c rm. As long as the completion is the full "container" (i.e. "con" isn't an entry) it wouldn't bother me, but for this reason I don't think it's necessary.

My 2c -- I'm not really a fan of completion on subcommands, since it requires that you install and maintain additional completion scripts instead of being something that works out of the box. In docker container's case as well, keep in mind that it's competing with docker commit and others for the same completion, so by the time you've typed enough characters to differentiate container for completion, you've already typed docker con anyway.

I wouldn't really like to see docker ps go away pretty much ever since it is such deeply ingrained habit for me, is extremely short and frequently invoked and I don't really mind having porcelain around the "true" commands (git style, i.e. "every command is just a wrapper around rebase"). But I understand the motivation.

I'd definitely like to see more elaboration around where we draw the lines here, e.g., why would it be OK for docker service scale foo=3 to alias to docker service update --replicas 3 foo (porcelain wrapper like mentioned above) but not OK for docker ps to alias to docker container ls.

@icecrime icecrime mentioned this pull request Aug 29, 2016
2 tasks
@stevvooe
Copy link
Contributor

I'm not sure that we can change inspect, but we could definitely introduce a new command that defaults to pretty print, and hide inspect from help. Do you know if there is an issue with a proposal for that change? I'd like to keep that discussion and change separate from this PR.

Not that I know of. File away or ping me again and I'll cook something up.

I agree that this shouldn't be a part of this PR, if we frame it that way.

@dnephin
Copy link
Member Author

dnephin commented Sep 8, 2016

This is now rebased, and no longer hides the commands. It only adds the new canonical commands.

@dnephin dnephin force-pushed the cli-new-command-structure branch from de52a08 to 7916d26 Compare September 9, 2016 15:06
@dnephin dnephin force-pushed the cli-new-command-structure branch from fed1b39 to a7c8bca Compare September 19, 2016 17:30
@thaJeztah
Copy link
Member

Just discussed with @dnephin that we're gonna do docs (and completion scripts) in a follow-up PR. I'll open a tracking issue

@thaJeztah
Copy link
Member

And, it's green!

@thaJeztah thaJeztah merged commit ad9ceff into moby:master Sep 19, 2016
@dnephin dnephin deleted the cli-new-command-structure branch September 19, 2016 20:31
@vieux
Copy link
Contributor

vieux commented Sep 19, 2016

LGTM !

@icecrime
Copy link
Contributor

👏

@gittycat
Copy link

Is there any chance of differentiating between Legacy|old|standalone Swarm and "Swarm Mode" at least in the doc. For instance:

Management Commands:
  ...
  node        Manage Docker Swarm mode nodes
  service     Manage Docker services
  swarm       Manage Docker legacy Swarm
  ...

The old vs new swarm is a recurring area of misunderstanding over at Stackoverflow and elsewhere. The "swarm mode" should really have been named something else in my opinion. Sorry to bring this up here but since we're stuck with "Swarm" I would love the doc to at least acknowledge that it's dealing with two different technologies and use some naming to help distinguish them.

@dnephin
Copy link
Member Author

dnephin commented Sep 20, 2016

@gittycat docker swarm is not the legacy swarm, it's the new "swarm mode". Only swarm is the old swarm, which is not available through this CLI.

@stevvooe
Copy link
Contributor

@gittycat Rule of thumb: if there is a docker in front of your command, you're probably using Swarm-mode.

I usually refer to them as "Docker Services" for clarification.

@albers
Copy link
Member

albers commented Oct 25, 2016

ping @sdurrheimer there's a lot of work waiting for you here 😰, PTAL

@sdurrheimer
Copy link
Contributor

@albers I see 😲, thx for the ping.

@lpalgarvio
Copy link

kudos!

i was actually using custom make scripts to do just this with almost equal commands!!!

thanks for standardizing in 1.13! saved me from opening a ticket =)

@icetech233

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment