Docker Container Density Calculator
Determine how many containers can run per host given CPU, memory and overhead.
Inputs
Total CPU cores on the host.
Total RAM on the host.
CPU allocated per container.
Memory allocated per container.
Percentage of resources reserved for the OS and Docker daemon.
Max Containers per Host
57
Limiting Resource
CPU
Max by CPU
57
Max by Memory
230
Step by step
Available CPU after system reserve
16 × (1 − 10%)
= 14.4 cores
Available memory after reserve
64GB × (1 − 10%)
= 57.6GB
Max containers by CPU
14.4 / 0.25
= 57
Max containers by memory
58982MB / 256MB
= 230
How it works
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
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.
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