Skip to content

Unclear what a type is when using docker inspect #6047

Open

Description

@rcjsuen

Description

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

Activity

  1. thaJeztah commented on May 6, 2025

    @thaJeztah
    Member

    Thanks for reporting; the list of options accepted for --type is documented in the CLI reference documentation; https://docs.docker.com/reference/cli/docker/inspect/#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.

  2. thaJeztah commented on May 6, 2025

    @thaJeztah
    Member
  3. TastyHeadphones commented on Sep 19, 2026

    @TastyHeadphones

    Opened #7315 — lists the allowed types in the --type help text.

  4. TastyHeadphones commented on Sep 19, 2026

    @TastyHeadphones

    PR: #7315

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions