Skip to content

Proposal: Add a 'docker image' command #13509

@duglin

Description

@duglin

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cliClientkind/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