MCPcopy Create free account
hub / github.com/containerd/nerdctl / Inspect

Function Inspect

pkg/cmd/container/inspect.go:38–63  ·  view source on GitHub ↗

Inspect prints detailed information for each container in `containers`.

(ctx context.Context, client *containerd.Client, containers []string, options types.ContainerInspectOptions)

Source from the content-addressed store, hash-verified

36
37// Inspect prints detailed information for each container in `containers`.
38func Inspect(ctx context.Context, client *containerd.Client, containers []string, options types.ContainerInspectOptions) ([]any, error) {
39 dataStore, err := clientutil.DataStore(options.GOptions.DataRoot, options.GOptions.Address)
40 if err != nil {
41 return []any{}, err
42 }
43
44 f := &containerInspector{
45 mode: options.Mode,
46 size: options.Size,
47 snapshotter: containerdutil.SnapshotService(client, options.GOptions.Snapshotter),
48 dataStore: dataStore,
49 namespace: options.GOptions.Namespace,
50 }
51
52 walker := &containerwalker.ContainerWalker{
53 Client: client,
54 OnFound: f.Handler,
55 }
56
57 err = walker.WalkAll(ctx, containers, true)
58 if err != nil {
59 return []any{}, err
60 }
61
62 return f.entries, nil
63}
64
65type containerInspector struct {
66 mode string

Callers 2

inspectActionFunction · 0.92
inspectActionFunction · 0.92

Calls 3

WalkAllMethod · 0.95
DataStoreFunction · 0.92
SnapshotServiceFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…