Skip to content
Calcrivo

Docker Container Density Calculator

Determine how many containers can run per host given CPU, memory and overhead.

Inputs

cores

Total CPU cores on the host.

GB

Total RAM on the host.

cores

CPU allocated per container.

MB

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

  1. Available CPU after system reserve

    16 × (1 − 10%)

    = 14.4 cores

  2. Available memory after reserve

    64GB × (1 − 10%)

    = 57.6GB

  3. Max containers by CPU

    14.4 / 0.25

    = 57

  4. 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