Docker Container Density Calculator
Determine how many containers can run per host given CPU, memory and overhead.
About Docker Container Density Calculator
Container density is limited by whichever resource (CPU or memory) runs out first. Formula: maxContainers = min(availableCPU/cpuPerContainer, availableMemory/memoryPerContainer), after reserving resources for the OS and Docker daemon.
Formula
Max Containers
max = min(availableCPU / cpuPerContainer, availableMemory / memPerContainer)
- availableCPU
- Host CPU minus system reserve
- cpuPerContainer
- CPU allocated per container
- availableMemory
- Host memory minus reserve
- memPerContainer
- Memory per container
Worked example
With the default values below, Docker Container Density Calculator returns Max Containers per Host of 57. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Host CPU Coresaccepts 1–1,024 cores
- 16 cores
- Host Memoryaccepts 1–16,384 GB
- 64 GB
- CPU per Containeraccepts 0.01–128 cores
- 0.25 cores
- Memory per Containeraccepts 1–1,048,576 MB
- 256 MB
- System Reservedaccepts 0–50 %
- 10 %
Results
- Max Containers per Host
- 57
- Limiting Resource
- CPU
- Max by CPU
- 57
- Max by Memory
- 230
Step by step
- 1Available CPU after system reserve= 14.4 cores
- 2Available memory after reserve= 57.6GB
- 3Max containers by CPU= 57
- 4Max containers by memory= 230
Assumptions and limits
- The result is derived only from the 5 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
Should I set CPU limits equal to requests?
For predictable density planning yes, but in practice many teams set limits higher than requests to allow bursting when other containers are idle, improving utilization at the cost of predictability.
What about PID limits?
Linux kernels have a default PID limit (~32768) shared across all containers. Very high container density with many threads per container can hit this before CPU/memory limits.
Related Calculators
You might also need
- Docker Container Startup Time CalculatorCommonly used together
- Docker Log Growth CalculatorCommonly used together
- Docker Network Throughput CalculatorCommonly used together
- Docker Overlay Network CalculatorCommonly used together
- Docker Restart Policy EstimatorCommonly used together
- Docker Volume Size CalculatorCommonly used together
