ServerCalc
Reviews

How much RAM does a Docker container need? Official figures and the 2, 4 and 8 GB VPS that fit

Docker sets no RAM floor: the app inside does. PostgreSQL starts at 128 MB, Nextcloud asks 512 MB per process. 2 to 8 GB VPS plans from $3.50.

November 30, 2026ServerCalc Editorial10 min read

A Docker container has no RAM requirement of its own: by default it runs with no memory limit, and the smallest limit Docker accepts is 6 MB. The application inside sets the real number. PostgreSQL starts with a 128 MB buffer cache, MySQL with a 128 MB buffer pool, Nextcloud asks for 512 MB per PHP process and n8n uses about 180 MiB. In our catalog a 2 GB VPS costs from $3.50 a month, 4 GB $10.00 and 8 GB $19.16, prices checked November 29, 2026.

A container gets no memory limit unless you set one

Docker's resource constraints page says a container by default "has no resource constraints" and can use as much memory as the host kernel allows. A container is an isolated process, not a virtual machine, with no reserved block of RAM. Ten idle containers cost little; one with a memory leak can take the whole server.

So "how much RAM per container" has no single answer: a static site behind nginx and a PostgreSQL database are both one container. Size the server by adding up the services, not by counting containers.

The app inside sets the number: official figures for common images

What the projects themselves publish. These are starting points, not ceilings.

Service in the container Official memory figure What makes it grow
PostgreSQL 18 shared_buffers default 128 MB; about 25% of RAM suggested on a dedicated database server with 1 GB or more work_mem (4 MB default) per sort or hash, times parallel queries
MySQL 8.4 InnoDB buffer pool 128 MB by default innodb_dedicated_server sets the pool to 50% of memory on 1 to 4 GB, 75% above 4 GB
Nextcloud 35 at least 128 MB per process, 512 MB per process recommended number of PHP workers serving users at once
n8n around 180 MiB on average for the software large files, big JSON payloads, Code node runs

Add the operating system, the Docker daemon and a reverse proxy on top. Docker publishes no RAM figure for the daemon, so measure it with free -m before and after you start the stack.

2 GB runs a proxy and light apps, 4 GB a stack with a database, 8 GB a self-hosted suite

These tiers are our sizing for the VPS for Docker page, built on the figures above. The table matches each tier to the three cheapest plans in our catalog.

Typical stack RAM we size for Cheapest plans at that tier vCPU / disk Price a month
Reverse proxy, a static site, one or two small APIs 2 GB VPS.org Starter, New Jersey 1 / 10 GB SSD $3.50
Hostman Cloud 3, Europe or New York 2 / 60 GB NVMe $7.00
MassiveGRID Growth, Europe 2 / 64 GB NVMe $7.98
App, PostgreSQL, Redis and a proxy in one compose file 4 GB or more VPSDime Linux VPS 6 GB, USA 4 / 30 GB NVMe $7.00
Hostman Cloud 4, Europe or New York 2 / 80 GB NVMe $10.00
Ethernet Servers VPS 4 GB, USA or Europe 2 / 160 GB SSD $12.00
Several stacks: Nextcloud, n8n, monitoring, two databases 8 GB MassiveGRID Professional, Singapore 4 / 128 GB NVMe $19.16
Hostman Cloud 5, Europe or New York 4 / 160 GB NVMe $22.00
Ethernet Servers VPS 8 GB, USA or Europe 4 / 320 GB SSD $24.00

All plans bill monthly. VPSDime gives 6 GB for less than most 4 GB plans, but with 30 GB of disk. Hostman cloud plans are listed without an IPv4 address, so check that line at checkout. More plans per tier: cheapest 2 GB VPS, cheapest 4 GB VPS and cheapest 8 GB VPS.

Databases take the biggest share, so size them first

Take a hypothetical web app in one compose file: Caddy as the proxy, a Node.js API, PostgreSQL and Redis. The proxy and the API are the light part. PostgreSQL benefits from every extra megabyte, because its buffer cache keeps hot data off the disk.

PostgreSQL's documentation suggests about 25% of RAM for shared_buffers on a dedicated database server. A Docker host is not dedicated, so keep the 128 MB default on 2 GB and raise it from 4 GB. work_mem applies per sort, and many connections multiply it.

MySQL's innodb_dedicated_server option hands 50 to 75% of detected memory to the buffer pool: right for a database-only machine, wrong on a VPS shared with other containers. For a database as the main workload, see VPS for databases.

Want the plans filtered for this case? Open the calculator with the Docker task: it preselects 2 vCPU and 4 GB and sorts plans by price and location.

Set a limit on every container so one leak cannot take down the stack

When the host runs out of memory, the kernel kills a process. Docker's documentation says it protects the daemon by lowering its OOM priority, but "the OOM priority on containers isn't adjusted". The kernel can pick your database as easily as the leaking container.

Give each service a hard limit (mem_limit in Compose, --memory in docker run) a little above its use under load. A container that hits its own limit is killed alone, while the rest keep running. --memory-reservation adds a soft limit, which Docker says does not guarantee the container stays under it.

To find the numbers, run the stack under real load and read docker stats --no-stream: it shows each container's memory against its limit. Add the system overhead and keep 20 to 30% free for spikes and the page cache.

A large PHP or Java app moves the server up a tier

Process-per-request apps scale memory with traffic. Nextcloud's 512 MB is per PHP process, so four workers serving users at once take 2 GB before the database. A small-team Nextcloud with PostgreSQL and Redis lands in the 4 GB tier, a busier one in 8 GB.

The same logic applies to PHP sites, see how many websites a 2 GB VPS can host, and to automation, see how much RAM n8n needs. With several such apps, cores matter too: dedicated vs shared vCPU. Watch the disk as well: images and logs fill a 10 GB plan long before RAM runs out, so plan 40 GB or more with a database, ideally NVMe.

Not sure which tier your stack needs? Run it for a few days on a VPS with hourly billing, read docker stats, then pick a monthly plan on VPS for Docker.

Frequently asked questions

How much RAM does a Docker container need?

Docker sets no minimum: a container has no memory limit by default, and the smallest limit you can set is 6 MB. The application decides. PostgreSQL starts with a 128 MB buffer cache, Nextcloud recommends 512 MB per PHP process, n8n uses about 180 MiB.

How many Docker containers can a 2 GB VPS run?

A reverse proxy, a static site and one or two small APIs fit. An app with a database is more comfortable on 4 GB.

Should I set memory limits on Docker containers?

Yes. Without limits one leaking container can exhaust the host, and the kernel may kill a different container. A hard limit per service keeps the damage inside it.

How do I check how much memory my containers use?

Run docker stats --no-stream under real load: it lists each container's memory usage and limit.

How much does a VPS for Docker cost per month?

In our catalog, checked November 29, 2026: from $3.50 for 2 GB, $7.00 for 6 GB on VPSDime, $10.00 for 4 GB on Hostman with NVMe, and $19.16 to $24.00 for 8 GB.

Read also

Plan prices come from our catalog, checked on each provider's pricing page on November 29, 2026. Docker, PostgreSQL 18, MySQL 8.4 and Nextcloud 35 figures are from their official documentation, checked November 30, 2026; the n8n figure from docs.n8n.io, checked November 16, 2026.

Provider from this article

Hostman

plans in our base from $7 / month

This is an affiliate link: if you sign up, we earn a commission. The price for you does not change. Hostman is a partner of the service and gets a 10-point bonus in the «Best match» sort, as described in the methodology