dockermem

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dockermem measures what the Docker VM actually has and uses.

Declared limits are useless for this: one my-app stack declares more than 13 GB of mem_limit across its services yet runs in about 2 GB, because mem_limit is a ceiling and not a reservation. Only measurement tells you whether one more stack fits.

Index

Constants

View Source
const WarnRatio = 0.85

WarnRatio is the share of the Docker VM above which starting one more stack is worth a warning.

Variables

This section is empty.

Functions

func Human

func Human(n int64) string

func ParseSize

func ParseSize(s string) (int64, error)

ParseSize reads the sizes docker stats prints, e.g. "334.2MiB", "1.47GiB".

Types

type Usage

type Usage struct {
	Total int64 // bytes available to the VM
	Used  int64 // bytes used by every running container
	// StackUsed excludes one-off `compose run` containers: a migration
	// container peaking at 6 GB is not what a stack costs, and counting it
	// would triple the estimate.
	StackUsed int64
	Projects  int // distinct compose projects, one-offs excluded
}

func Read

func Read(ctx context.Context, runner execx.Runner) (Usage, error)

func (Usage) PerProject

func (u Usage) PerProject() int64

PerProject is the average cost of a running stack, the best available estimate of what one more would cost.

func (Usage) Projected

func (u Usage) Projected() int64

func (Usage) Tight

func (u Usage) Tight() bool

func (Usage) Warning

func (u Usage) Warning() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL