Inspect prints detailed information for each container in `containers`.
(ctx context.Context, client *containerd.Client, containers []string, options types.ContainerInspectOptions)
| 36 | |
| 37 | // Inspect prints detailed information for each container in `containers`. |
| 38 | func 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 | |
| 65 | type containerInspector struct { |
| 66 | mode string |
no test coverage detected
searching dependent graphs…