Calculator Apps

💰 Finance

EMI Calculator SIP Calculator GST Calculator Income Tax Calculator Percentage Calculator CTC Calculator PF Interest Calcualtor Electricity Consumption Calcualtor Credit Card Interest Calcualtor UPI Charge Calcualtor

💖 Health

BMI Calculator Calorie Calculator Body Fat

🛠️ Developer Tools

JSON Formatter JSON Converter Password Generator Word Counter Invoice Generator Youtube Thumbnail Downloader PDF Tools QR Generator Dummy Data Generator Resume Generator Timestamp Converter AI Logo Generator URL Encoder / Decoder Open Graph Generator Data Sanitizer JSON Path Extractor YAML To TOMAL YAML To JSON Mermaid Live Editor

🖼️ Image Tools

Image Format Converter Image Size Compressor Favicon Generator Image Crop & Resize

📄 CSS Tools

CSS Gradient Generator Box Shadow Generator Flexbox Generator CSS Grid Generator Color Palette Generator

🎬 Entertainment Tools

Love Calcualtor

🛠️ Text Tools

Case Converter Remove Duplicate Lines Text Sorter Reverse Text Remove Empty Lines Find And Replace MarkDown Editor Unique Code Converter ASCII Converter Slugify String

☁ Cloud Tools

AWS Cron Generator Azure Cron Generator Google Cron Generator IAM Policy Validator S3 Bucket Policy Generator Terraform Variable Generator Terraform Formatter Terraform Validator Kubernetes Resource Calculator Docker Resource Calculator
🐳

Docker Resource Calculator

Work out container CPU/memory limits and total footprint, or size a host from your total resource needs.

Total CPU limit (all instances)
Total CPU reserved (all instances)
Total Memory limit (all instances)
Total Memory reserved (all instances)
docker run Command
docker-compose.yml Snippet
Usable CPU per host (after overhead)
Usable Memory per host (after overhead)
Hosts needed (CPU-bound)
Hosts needed (Memory-bound)
Recommended host count

Recommendation takes the larger of the CPU-bound and memory-bound counts, since a host fleet is limited by whichever resource runs out first.

What Docker's CPU and memory flags actually control

Docker doesn't use the word "request" the way an orchestrator like Kubernetes does, but the same idea exists under different flag names. --memory is a hard ceiling: once a container crosses it, the kernel's OOM killer terminates a process inside the container. --memory-reservation is a soft floor that only kicks in when the host is under memory pressure, which is the closest thing Docker has to a "guaranteed minimum." CPU works similarly: --cpus caps how much CPU time a container can use, expressed as a decimal number of cores (1.5 means one and a half cores' worth of CPU time), while --cpu-shares sets a relative weight used only when multiple containers are competing for CPU — it does nothing when the host has spare capacity.

FlagTypeWhat it does
--cpusHard limitCaps CPU time to N cores; container is throttled beyond that, never killed for it
--cpu-sharesSoft weightRelative priority (default 1024) used only when CPU is contended
--memoryHard limitContainer is OOM-killed if it tries to exceed this
--memory-reservationSoft floorKernel tries to keep the container above this under memory pressure, no guarantee
--memory-swapSwap ceilingTotal of memory + swap the container may use; set equal to --memory to disable swap

Worked example

Say you're deploying an API service with three instances behind a load balancer. Each container needs at least 0.25 CPU cores and 256 MB of memory to run comfortably, but you want to allow bursts up to 1 core and 512 MB before Docker steps in. Plugging cpuLim = 1, cpuRes = 0.25, memLim = 512, memRes = 256, and replicas = 3 into the Container Limits tab gives you a total ceiling of 3 cores and 1,536 MB across the three instances, with a guaranteed floor of 0.75 cores and 768 MB. That total is what you should compare against your host's usable capacity before deploying — not the per-container numbers alone, which look small in isolation but add up fast at scale.

Now switch to the Host Sizing tab and enter that same 3-core, 1.5 GB requirement alongside every other service sharing the host. If your combined workloads across all services need 18 cores and 48 GB, and each host has 8 vCPUs and 32 GB with a 10% overhead reserved for the OS and Docker daemon, the calculator returns roughly 7.2 usable cores and 28.8 GB usable per host — meaning you'd need 3 hosts on the CPU side and 2 on the memory side. Since a fleet is bottlenecked by whichever resource fills up first, the recommended count is 3 hosts, with memory to spare.

Common mistakes

  • Setting a reservation above the limit. If --memory-reservation or a CPU reservation is higher than the corresponding limit, Docker will refuse the configuration or behave unpredictably — the reservation is supposed to be a soft floor beneath the hard ceiling, never above it.
  • Forgetting to multiply by replica count. A single container's limits look harmless, but three or ten copies of it running side by side can quietly exhaust a host that looked like it had plenty of headroom.
  • Confusing --cpu-shares with a hard cap. Shares only matter when the CPU is actually contended; on an idle host a container with low shares can still use every core available.
  • Leaving swap unset. Without an explicit --memory-swap, a container can quietly spill into swap instead of being OOM-killed, which trades a clean failure for a slow, hard-to-diagnose one.
  • Ignoring the host's own overhead. The Docker daemon, logging drivers, and the OS kernel all need headroom; planning against 100% of a host's raw CPU and memory leaves nothing for the system itself.
  • Mixing binary and decimal units. "512 MB" in a spec sheet and "512 MiB" in a container flag aren't identical — the difference is small per container but compounds across a large fleet.

Best practices

  • Set both a reservation and a limit for every production container, not just a limit — the reservation is what keeps a noisy neighbor from starving your service under contention.
  • Load-test a container to find its real steady-state usage before setting limits; guessing tends to produce limits that are either far too generous or that throttle the app under normal load.
  • Always pin --memory-swap equal to --memory for latency-sensitive services so they fail fast and visibly instead of degrading silently into swap.
  • Size hosts with at least 10–15% headroom reserved for the OS, Docker daemon, and logging, and re-check that margin whenever you add a new service to a shared host.
  • Track actual usage with docker stats or a metrics stack after deployment, and revisit your limits periodically — resource needs drift as code and traffic patterns change.
  • Use the same reservation-to-limit ratio across similar services so capacity planning stays predictable as you scale the fleet up or down.

FAQ

What's the difference between a limit and a reservation?
A limit is a hard ceiling the container cannot cross without being throttled (CPU) or killed (memory). A reservation is a soft floor the kernel tries to protect only when the host is under resource pressure — it isn't enforced when the host has spare capacity.
Why does my container get OOM-killed even though the host has free memory?
The --memory flag is enforced per container by the kernel's cgroup limits regardless of what's free on the host. A container hitting its own limit gets killed even if the rest of the machine is nearly idle.
Is 1.0 in --cpus the same as one full CPU core?
Yes — --cpus 1.0 caps the container at the equivalent of one full core's worth of CPU time. --cpus 0.5 caps it at half a core, and --cpus 2 allows up to two cores' worth, spread across however many cores are available.
Should I set --memory-swap at all?
For most production services, yes — set it equal to --memory to disable swap entirely, so an over-limit container is killed cleanly instead of slowing down unpredictably while swapping.
Does this calculator account for sidecar or helper containers?
No — it calculates one container's resources times the instance count. If your setup runs additional containers alongside it (a log shipper, proxy, etc.), add their limits separately.
How much overhead should I reserve on a host?
10–15% is a reasonable starting point for the OS, Docker daemon, and logging. Hosts running heavier logging drivers or many small containers may need more, since each container carries some fixed per-container overhead.
Why is my recommended host count based on memory, not CPU?
The calculator takes the larger of the CPU-bound and memory-bound counts. If your workloads are memory-heavy relative to their CPU needs, memory will run out first and drive the total host count even though CPU has spare capacity.
Are the numbers from this calculator exact for my cloud provider?
They're a planning estimate. Actual usable capacity varies by cloud provider, kernel version, and what else runs on the host, so treat the output as a starting point and validate with real load testing.