MCPcopy Index your code
hub / github.com/docker/cli / newInspectCommand

Function newInspectCommand

cli/command/container/inspect.go:25–45  ·  view source on GitHub ↗

newInspectCommand creates a new cobra.Command for `docker container inspect`

(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

23
24// newInspectCommand creates a new cobra.Command for `docker container inspect`
25func newInspectCommand(dockerCLI command.Cli) *cobra.Command {
26 var opts inspectOptions
27
28 cmd := &cobra.Command{
29 Use: "inspect [OPTIONS] CONTAINER [CONTAINER...]",
30 Short: "Display detailed information on one or more containers",
31 Args: cli.RequiresMinArgs(1),
32 RunE: func(cmd *cobra.Command, args []string) error {
33 opts.refs = args
34 return runInspect(cmd.Context(), dockerCLI, opts)
35 },
36 ValidArgsFunction: completion.ContainerNames(dockerCLI, true),
37 DisableFlagsInUseLine: true,
38 }
39
40 flags := cmd.Flags()
41 flags.StringVarP(&opts.format, "format", "f", "", flagsHelper.InspectFormatHelp)
42 flags.BoolVarP(&opts.size, "size", "s", false, "Display total file sizes")
43
44 return cmd
45}
46
47func runInspect(ctx context.Context, dockerCLI command.Cli, opts inspectOptions) error {
48 apiClient := dockerCLI.Client()

Callers 1

newContainerCommandFunction · 0.70

Calls 1

runInspectFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…