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

Function getContainerSize

pkg/cmd/container/list.go:233–248  ·  view source on GitHub ↗
(ctx context.Context, snapshotter snapshots.Snapshotter, snapshotKey string)

Source from the content-addressed store, hash-verified

231}
232
233func getContainerSize(ctx context.Context, snapshotter snapshots.Snapshotter, snapshotKey string) (string, error) {
234 // get container snapshot size
235 var containerSize int64
236 var imageSize int64
237
238 if snapshotKey != "" {
239 rw, all, err := imgutil.ResourceUsage(ctx, snapshotter, snapshotKey)
240 if err != nil {
241 return "", err
242 }
243 containerSize = rw.Size
244 imageSize = all.Size
245 }
246
247 return fmt.Sprintf("%s (virtual %s)", progress.Bytes(containerSize).String(), progress.Bytes(imageSize).String()), nil
248}

Callers 1

prepareContainersFunction · 0.85

Calls 2

ResourceUsageFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…