MCPcopy Create free account
hub / github.com/docker/compose / Size

Method Size

cmd/formatter/container.go:282–295  ·  view source on GitHub ↗

Size returns the container's size and virtual size (e.g. "2B (virtual 21.5MB)")

()

Source from the content-addressed store, hash-verified

280
281// Size returns the container's size and virtual size (e.g. "2B (virtual 21.5MB)")
282func (c *ContainerContext) Size() string {
283 if c.FieldsUsed == nil {
284 c.FieldsUsed = map[string]any{}
285 }
286 c.FieldsUsed["Size"] = struct{}{}
287 srw := units.HumanSizeWithPrecision(float64(c.c.SizeRw), 3)
288 sv := units.HumanSizeWithPrecision(float64(c.c.SizeRootFs), 3)
289
290 sf := srw
291 if c.c.SizeRootFs > 0 {
292 sf = fmt.Sprintf("%s (virtual %s)", srw, sv)
293 }
294 return sf
295}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected