Skip to content

Flag Addition: --type flag added for docker inspect command#13187

Merged
thaJeztah merged 1 commit intomoby:masterfrom
shishir-a412ed:docker_inspect_issue
Jul 1, 2015
Merged

Flag Addition: --type flag added for docker inspect command#13187
thaJeztah merged 1 commit intomoby:masterfrom
shishir-a412ed:docker_inspect_issue

Conversation

@shishir-a412ed
Copy link
Copy Markdown
Contributor

Fixes #12483

Signed-off-by: Shishir Mahajan [email protected]

@jessfraz
Copy link
Copy Markdown
Contributor

why two flags its not really scalable...

@calavera
Copy link
Copy Markdown
Contributor

I'm 👎 to the solution, but I acknowledge the problem.

There are a couple possibilities that might be better suitable to solve the problem:

  1. Since we acknowledge that a container and an image can have the same name, we can argue that we should always perform the two calls. This is probably the easier solution, 0 flags needed. We can be slightly fancy and try to detect whether the argument is a container id or not, and only send the container request in the first case.
  2. If we don't want to send two requests every time, we can add a --all flag and do what I propose in 1 when the flag is enabled.

@shishir-a412ed
Copy link
Copy Markdown
Contributor Author

@calavera
we contemplated that option but we felt it can present an awful lot of information to user.
e.g. docker inspect --all arg1 arg2 arg3 ..... argN can show N * 2 JSON to the user, whereas all user wanted was to see the image JSON which were being shadowed by the container JSON, since they shared the same name.

@cpuguy83
Copy link
Copy Markdown
Member

What if we do --image and --container, but make them both true by default.

@jessfraz
Copy link
Copy Markdown
Contributor

No 2 flags!!!

On Wednesday, May 13, 2015, Brian Goff [email protected] wrote:

What if we do --image and --container, but make them both true by default.


Reply to this email directly or view it on GitHub
#13187 (comment).

@cpuguy83
Copy link
Copy Markdown
Member

Ok, --type

@duglin
Copy link
Copy Markdown
Contributor

duglin commented May 14, 2015

oh man, can we please consider just adding a new command: docker inspecti ... like we have docker rmi .... I'm not thrilled with just adding an 'i' to the end of the command but at least we're consistent and it would then be very clear what we're talking about.

@rhatdan
Copy link
Copy Markdown
Contributor

rhatdan commented May 14, 2015

I don't really understand the argument against two arguments. It is not like the docker inspect has a whole ton of options now. Originally we were going to use just --image-only, but then why couldn't you ask for only container matches.

Bottom line is we have bug reports from people trying to look at images with the same name as a container, and we want a simple way for the users to be able to examine them without having to understand where to search for the UUid field in a container json file.

I actually hate rmi versus rm, but I guess that somewhat follows the standard of rm versus rmdir.

If we went with this behaviour we should break existing behaviour for consistency.

This seems like a simple fix, but simple fixes often bring out Bike Shedding arguments.

@jessfraz
Copy link
Copy Markdown
Contributor

It's a UI decision I know the struggle with it being the same name but two
flags is imo dumb and doesn't scale

On Thursday, May 14, 2015, Daniel J Walsh [email protected] wrote:

I don't really understand the argument against two arguments. It is not
like the docker inspect has a whole ton of options now. Originally we were
going to use just --image-only, but then why couldn't you ask for only
container matches.

Bottom line is we have bug reports from people trying to look at images
with the same name as a container, and we want a simple way for the users
to be able to examine them without having to understand where to search for
the UUid field in a container json file.

I actually hate rmi versus rm, but I guess that somewhat follows the
standard of rm versus rmdir.

If we went with this behaviour we should break existing behaviour for
consistency.

This seems like a simple fix, but simple fixes often bring out Bike
Shedding arguments.


Reply to this email directly or view it on GitHub
#13187 (comment).

@shishir-a412ed
Copy link
Copy Markdown
Contributor Author

@jfrazelle what do you mean by 2 flags doesn't scale ?
Can you give an example or scenario ?

@rhatdan
Copy link
Copy Markdown
Contributor

rhatdan commented May 14, 2015

Not sure how adding additional commands scales better then adding options. I would argue the exact opposite.

@jessfraz
Copy link
Copy Markdown
Contributor

Adding 2 flags that are super specific to 1 thing is "not scalable" because
now if you inspect anything other than images or containers in docker, whoa
look we need to add a new flag for that too

But honestly I don't want to fight about this, do what you want, see what
happens when users think docker is hard to use because we have a bajillion
flags, each one does 1 thing

On Thursday, May 14, 2015, Daniel J Walsh [email protected] wrote:

Not sure how adding additional commands scales better then adding options.
I would argue the exact opposite.


Reply to this email directly or view it on GitHub
#13187 (comment).

@jessfraz
Copy link
Copy Markdown
Contributor

Also I'm definitely -1 on a inspecti, rmi is awful and we should not go
down that road again, the only ok example given here was --type because at
least we can add more things to inspect in the future without a new flag
for each one

On Thursday, May 14, 2015, Jessica Frazelle [email protected] wrote:

Adding 2 flags that are super specific to 1 thing is "not scalable"
because now if you inspect anything other than images or containers in
docker, whoa look we need to add a new flag for that too

But honestly I don't want to fight about this, do what you want, see what
happens when users think docker is hard to use because we have a bajillion
flags, each one does 1 thing

On Thursday, May 14, 2015, Daniel J Walsh <[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');> wrote:

Not sure how adding additional commands scales better then adding
options. I would argue the exact opposite.


Reply to this email directly or view it on GitHub
#13187 (comment).

@shishir-a412ed
Copy link
Copy Markdown
Contributor Author

@jfrazelle
boolean flags are binary {true/false, 0/1} in nature. If that is your concern, then @cpuguy83 suggested --type flag which would be a string flag and can take all kind of values.

I understand your concern and its a valid one, but IMHO docker inspect really doesn't have that many flags to begin with. n the use-case is legitimate.

@rhatdan
Copy link
Copy Markdown
Contributor

rhatdan commented May 14, 2015

I am fine with --type=image or --type=container.

@duglin
Copy link
Copy Markdown
Contributor

duglin commented May 14, 2015

The only way a new flag helps, IMO, is if its mandatory. W/o it being required we’re then
still left with the current mess of the code guessing as to what the user intended to take action
on. That’s just a horrible design. While “rmi” and “inspecti” are not my favorite things,
at least its unambiguous and no room for confusion.

Ideally, I would have preferred if we had “docker container inspect” and “docker image inspect”
but that’s another discussion.

On May 14, 2015, at 7:25 AM, Jessie Frazelle [email protected] wrote:

Also I'm definitely -1 on a inspecti, rmi is awful and we should not go
down that road again, the only ok example given here was --type because at
least we can add more things to inspect in the future without a new flag
for each one

On Thursday, May 14, 2015, Jessica Frazelle [email protected] wrote:

Adding 2 flags that are super specific to 1 thing is "not scalable"
because now if you inspect anything other than images or containers in
docker, whoa look we need to add a new flag for that too

But honestly I don't want to fight about this, do what you want, see what
happens when users think docker is hard to use because we have a bajillion
flags, each one does 1 thing

On Thursday, May 14, 2015, Daniel J Walsh <[email protected]
javascript:_e(%7B%7D,'cvml','[email protected]');> wrote:

Not sure how adding additional commands scales better then adding
options. I would argue the exact opposite.


Reply to this email directly or view it on GitHub
#13187 (comment).


Reply to this email directly or view it on GitHub #13187 (comment).

@jessfraz
Copy link
Copy Markdown
Contributor

I think there is a real use case for adding a flag for this, I've hit numerous times w my irssi container

@shishir-a412ed shishir-a412ed force-pushed the docker_inspect_issue branch 4 times, most recently from 17fed35 to 77f256f Compare May 14, 2015 17:53
@shishir-a412ed
Copy link
Copy Markdown
Contributor Author

@jfrazelle @calavera @rhatdan
I have updated the code and docs.

@shishir-a412ed shishir-a412ed force-pushed the docker_inspect_issue branch from 77f256f to ae180ed Compare May 14, 2015 20:00
@shishir-a412ed shishir-a412ed changed the title Flags Addition: --image-only and --container-only flags added for docker inspect command. Flag Addition: --type flag added for docker inspect command May 14, 2015
@shishir-a412ed shishir-a412ed force-pushed the docker_inspect_issue branch 2 times, most recently from af114c0 to 27491c4 Compare May 18, 2015 21:41
@jessfraz
Copy link
Copy Markdown
Contributor

design LGTM thanks

Comment thread man/docker-inspect.1.md
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@thaJeztah
Copy link
Copy Markdown
Member

Thanks @shishir-a412ed ! Added some comments inline.

Also, this needs documentation in the online reference as well; https://github.com/docker/docker/blob/master/docs/reference/commandline/inspect.md

@shishir-a412ed shishir-a412ed force-pushed the docker_inspect_issue branch 6 times, most recently from b9f8b0c to 97275c5 Compare July 1, 2015 15:48
@shishir-a412ed
Copy link
Copy Markdown
Contributor Author

@moxiegirl @thaJeztah I have made the changes.
Let me know if I missed anything.

Comment thread man/docker-inspect.1.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Really minor; some dots/comma's are incorrect here. But I'm okay with leaving that for someone else to fix.

Think it should be;

Getting information on an image where image name conflict with the container name, 
e.g., both image and container are named rhel7.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@thaJeztah
Copy link
Copy Markdown
Member

LGTM, thanks for being patient, @shishir-a412ed, I know it took a while!

ping @moxiegirl

@thaJeztah
Copy link
Copy Markdown
Member

Kicked experimental build, ready to merge if that passes

@shishir-a412ed
Copy link
Copy Markdown
Contributor Author

@thaJeztah Sounds good !

thaJeztah added a commit that referenced this pull request Jul 1, 2015
Flag Addition: --type flag added for docker inspect command
@thaJeztah thaJeztah merged commit 98f988f into moby:master Jul 1, 2015
@thaJeztah
Copy link
Copy Markdown
Member

\o/ merged!

@rhatdan
Copy link
Copy Markdown
Contributor

rhatdan commented Jul 2, 2015

Woo Hoo

sdurrheimer added a commit to sdurrheimer/docker that referenced this pull request Jul 14, 2015
- Add fluentd logging driver to zsh completion moby#12876
- Add inspect --type flag to zsh completion moby#13187
- Respect -H option in zsh completion moby#13195
- Fix number of argument limit for pause and unpause in zsh completion

Signed-off-by: Steve Durrheimer <[email protected]>
calavera pushed a commit to calavera/docker that referenced this pull request Jul 25, 2015
- Add fluentd logging driver to zsh completion moby#12876
- Add inspect --type flag to zsh completion moby#13187
- Respect -H option in zsh completion moby#13195
- Fix number of argument limit for pause and unpause in zsh completion

Signed-off-by: Steve Durrheimer <[email protected]>
tiborvass pushed a commit to tiborvass/docker that referenced this pull request Jul 27, 2015
- Add fluentd logging driver to zsh completion moby#12876
- Add inspect --type flag to zsh completion moby#13187
- Respect -H option in zsh completion moby#13195
- Fix number of argument limit for pause and unpause in zsh completion

Signed-off-by: Steve Durrheimer <[email protected]>
@shishir-a412ed shishir-a412ed deleted the docker_inspect_issue branch August 13, 2015 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"docker inspect" can't reach the image JSON when there is a same name container running.

10 participants