Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Add a 'docker image' command #13509

Closed
duglin opened this Issue May 27, 2015 · 8 comments

Comments

Projects
None yet
8 participants
@duglin
Copy link
Contributor

duglin commented May 27, 2015

Right now docker's mixing of container and image commands leads to a bit of a usability problem. For example, docker inspect doesn't know if we're talking about containers or images, so we check for both. Which can lead to conflicts since images and containers can have the same name, and partial IDs. Solutions like #13187 are ok but not really ideal. We have similar issues with 'docker rm', but in that case we created 'docker rmi', which works, but feels hacky.

It would be better if there was a dedicated docker image command so that its clear we're talking about images and not containers. It also allows us to add new image-specific commands (and container-specific commands at the top level) w/o the possibility of conflict.

While, people may naturally then ask about a docker container command, and that is certainly possible, but I'm not suggesting we do that right now. I think keeping all docker verb commands acting on containers makes sense because docker's main focus is on containers and the extra typing involved in writing docker container verb would IMO be a UX hit.

I've create a branch for people to play with to see how it feels: https://github.com/duglin/docker/tree/ImageCmd
All docker image verb commands just call the appropriate docker verb command so we can avoid duplication of logic/code. However it would require more code than what I show in the branch in order to finish this work and to give a better UX, in particular:

  • make the help for each image related command show both the docker verb and docker image verb help text in both flows
  • will need to add code so that the error messages show the correct command based on what the user used.
  • will need to leverage #13187 for docker image inspect or some other code if #13187 doesn't go in

I'm sure there's more, but this branch does seem to show that the basic idea does seem to work, but before I go much further I'd like to know if we'd like to head this direction.

To be clear, I'm not suggesting we remove the old docker verb commands at this time, we can't break people. I think this path is consistent with the proposals I've heard to add other top-level docker noun commands (like docker volume and docker network ...).

ping @crosbymichael @shykes

@duglin

This comment has been minimized.

Copy link
Contributor Author

duglin commented May 27, 2015

The commands it supports are:

docker image create [OPTIONS] CONTAINER [REPOSITORY[:TAG]]    (was commit)
docker image history ...
docker image list ...
docker image import ...
docker image inspect ...
docker image load ...
docker image pull ...
docker image push ...
docker image rm ...    (was rmi)
docker image save ...
docker image search ...
docker image tag ...
@thaJeztah

This comment has been minimized.

Copy link
Member

thaJeztah commented May 27, 2015

Thanks for creating this, I certainly like the idea. I do think that we'll have to think of providing shortcuts for frequently used commands. And, there's the discussion around using plural vs singular ("images" or "image").

@vdemeester

This comment has been minimized.

Copy link
Member

vdemeester commented May 27, 2015

@duglin I really like the idea too. I find the subcommand easy to grasp and it feels more coherent. It would probably be a pretty big change, in terms of documentation and also how / do we keep the actual ones but 👍.
@thaJeztah It might sound weird but I find the way git handles the shortcuts with the aliases pretty cool and a similar approach could be use (or just plain bash/zsh/.. aliases) — but it's probably to early to talk about that :).

@josephearl

This comment has been minimized.

Copy link

josephearl commented Mar 17, 2016

Makes a lot of sense to me, and aligns with the volume commands, e.g. docker volume rm.

I think having a clearer separation of containers and images will make the command line tool conceptually simpler for users, they no longer have to look at the entire command space, but only the sub-commands that apply to what they are interested in.

@RyanMagnusson

This comment has been minimized.

Copy link

RyanMagnusson commented Apr 4, 2016

@duglin is there anything left to do with this? I'd love to help out with this.

@duglin

This comment has been minimized.

Copy link
Contributor Author

duglin commented Apr 5, 2016

@RyanMagnusson it first needs to be accepted as an idea by the maintainers, otherwise a corresponding PR will probably be rejected.

ping @docker/maintainers

@calavera

This comment has been minimized.

Copy link
Contributor

calavera commented Apr 8, 2016

I like the idea of having an image subcommand. Tbh, I find docker inspect --image very user unfriendly. However, I think we should keep the original behavior as deprecated, as aliases to the new subcommands, at least for a couple of releases, if not more.

@dnephin

This comment has been minimized.

Copy link
Member

dnephin commented Aug 25, 2016

PR up #26025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.