MCPcopy Create free account
hub / github.com/docker/cli / runInspect

Function runInspect

cli/command/manifest/inspect.go:51–90  ·  view source on GitHub ↗
(ctx context.Context, dockerCli command.Cli, opts inspectOptions)

Source from the content-addressed store, hash-verified

49}
50
51func runInspect(ctx context.Context, dockerCli command.Cli, opts inspectOptions) error {
52 namedRef, err := normalizeReference(opts.ref)
53 if err != nil {
54 return err
55 }
56
57 // If list reference is provided, display the local manifest in a list
58 if opts.list != "" {
59 listRef, err := normalizeReference(opts.list)
60 if err != nil {
61 return err
62 }
63
64 imageManifest, err := newManifestStore(dockerCli).Get(listRef, namedRef)
65 if err != nil {
66 return err
67 }
68 return printManifest(dockerCli, imageManifest, opts)
69 }
70
71 // Try a local manifest list first
72 localManifestList, err := newManifestStore(dockerCli).GetList(namedRef)
73 if err == nil {
74 return printManifestList(dockerCli, namedRef, localManifestList, opts)
75 }
76
77 // Next try a remote manifest
78 registryClient := newRegistryClient(dockerCli, opts.insecure)
79 imageManifest, err := registryClient.GetManifest(ctx, namedRef)
80 if err == nil {
81 return printManifest(dockerCli, imageManifest, opts)
82 }
83
84 // Finally try a remote manifest list
85 manifestList, err := registryClient.GetManifestList(ctx, namedRef)
86 if err != nil {
87 return err
88 }
89 return printManifestList(dockerCli, namedRef, manifestList, opts)
90}
91
92func printManifest(dockerCli command.Cli, manifest types.ImageManifest, opts inspectOptions) error {
93 buffer := new(bytes.Buffer)

Callers 1

newInspectCommandFunction · 0.70

Calls 9

normalizeReferenceFunction · 0.85
newManifestStoreFunction · 0.85
printManifestFunction · 0.85
printManifestListFunction · 0.85
newRegistryClientFunction · 0.85
GetMethod · 0.65
GetListMethod · 0.65
GetManifestMethod · 0.65
GetManifestListMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…