You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unclear what a type is when using docker inspect #6047
The documentation for --type just says Return JSON for specified type. Could we improve this to include all the types or at least some of the commonly used ones?
$ docker -v
Docker version 28.1.1, build 4eba377
$ docker inspect --help
Usage: docker inspect [OPTIONS] NAME|ID [NAME|ID...]
Return low-level information on Docker objects
Options:
-f, --format string Format output using a custom template:
'json': Print in JSON format
'TEMPLATE': Print output using the given Go template.
Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates
-s, --size Display total file sizes if the type is container
--type string Return JSON for specified type
For most types, there's also an equivalent subcommand for each type, for example docker inspect --type container <something> is equivalent to docker container inspect <something>. Similarly, for other types;
docker container inspect
docker image inspect
docker volume inspect
docker service inspect
docker node inspect
docker config inspect
docker secret inspect
docker service inspect
docker network inspect
docker plugin inspect
I suspect the main reason for not including the list of accepted options in the flag description is that this would make the description very long, which would limit readability (but perhaps we should have a look if it would still be "reasonably" readable.
One thing we can improve is to make sure there's shell (tab) completion for this flag, so that shell-completion can provide hints on what options can be used. I have a branch doing so and will open a pull request for that.
For the flag-description, I'll have a look at a separate follow-up, as we'll have to discuss if the output is still readable with the large number of options possible.
Activity
thaJeztah commentedon May 6, 2025
Thanks for reporting; the list of options accepted for
--typeis documented in the CLI reference documentation; https://docs.docker.com/reference/cli/docker/inspect/#typeFor most types, there's also an equivalent subcommand for each type, for example
docker inspect --type container <something>is equivalent todocker container inspect <something>. Similarly, for other types;docker container inspectdocker image inspectdocker volume inspectdocker service inspectdocker node inspectdocker config inspectdocker secret inspectdocker service inspectdocker network inspectdocker plugin inspectI suspect the main reason for not including the list of accepted options in the flag description is that this would make the description very long, which would limit readability (but perhaps we should have a look if it would still be "reasonably" readable.
One thing we can improve is to make sure there's shell (tab) completion for this flag, so that shell-completion can provide hints on what options can be used. I have a branch doing so and will open a pull request for that.
For the flag-description, I'll have a look at a separate follow-up, as we'll have to discuss if the output is still readable with the large number of options possible.
thaJeztah commentedon May 6, 2025
Opened a PR for the tab-completion;
--typeand improve validation #6052TastyHeadphones commentedon Sep 19, 2026
Opened #7315 — lists the allowed types in the --type help text.
TastyHeadphones commentedon Sep 19, 2026
PR: #7315