Picking a VPS for self-hosting usually starts with a guess. Two gigabytes should be fine, right? Sometimes it is. Sometimes the server starts killing containers at 3 AM because memory ran out and the operating system had to pick a victim. This guide replaces the guess with a method: budget memory per service, measure what you actually use, and buy one size up from the math.
Why counting containers does not work
Two containers can use anywhere from 100 MB to 6 GB of RAM depending on what runs inside them. Vaultwarden and Nextcloud are both “one container” but they are not in the same league. Vaultwarden is a single lightweight binary that idles near 100 MB. Nextcloud is a PHP application that wants half a gigabyte for itself, plus a database and a cache to feel responsive. Size the contents, not the count.
There is also overhead people forget. The Docker daemon itself sits around 200 to 300 MB of resident memory on a typical host, and the operating system needs a few hundred more for the kernel, filesystem cache, and SSH. That is roughly 500 to 700 MB gone before your first app starts.
Realistic memory budgets per service
These are practical planning ranges pulled from community guides and the apps’ own requirements. Treat them as starting budgets, then adjust with measurements from your own server.
- Docker daemon and OS baseline: 500 to 700 MB
- Reverse proxy (Nginx, Caddy, Nginx Proxy Manager): 50 to 256 MB
- Vaultwarden: 128 MB
- Redis or Valkey: 128 MB
- PostgreSQL: 512 MB
- Nextcloud app: 512 MB (plus its own Postgres and Redis on top)
- WordPress stack: 512 MB for PHP, 512 MB for MySQL
- Immich: 2 GB for the server and machine learning containers. The official requirements list 6 GB of system RAM as the minimum with machine learning features enabled, and 4 GB only with those features turned off.
- Jellyfin: around 1 GB without transcoding, around 4 GB with transcoding running
The jump from a light utility app to a media app is the thing that catches people. A server that runs Vaultwarden, Uptime Kuma, and a reverse proxy all day at 1 GB can still fall over the moment you add Immich and start indexing a photo library.
Three example stacks, with the math
The 2 GB light stack
Reverse proxy plus Vaultwarden plus Uptime Kuma plus a static site. Budget: 600 MB baseline, 100 MB proxy, 128 MB Vaultwarden, about 150 MB for Uptime Kuma, 100 MB for the static site. That lands near 1.1 GB, so a 2 GB plan leaves comfortable headroom and is the most sensible floor for anything you depend on.
The 4 GB standard stack
WordPress with MySQL, Nextcloud with Postgres and Redis, reverse proxy. Budget: 600 MB baseline, 100 MB proxy, 512 MB PHP, 512 MB MySQL, 512 MB Nextcloud, 512 MB Postgres, 128 MB Redis. That totals about 2.9 GB, and a 4 GB plan absorbs the spikes without touching swap. This is the sweet spot for a first real self-hosted setup.
The 8 GB media stack
Immich with machine learning, Jellyfin with transcoding, plus the standard stack above. Immich alone asks for 6 GB of system RAM minimum, and transcoding Jellyfin wants 4 GB with spare cores. Here 8 GB is the honest starting point and 16 GB is where it stops feeling tight. Media apps are where “start small and grow” stops working.
Measure, then trust the numbers
Budgets get you a plan. Measurements keep it honest. Docker shows live usage per container:
- docker stats gives a live view of CPU and memory per container.
- docker stats –no-stream gives a one-shot snapshot you can log and compare over a week.
Watch for a full week, including the heavy moments like backups, library scans, and uploads. Note the peak each container hits. A widely used rule from self-hosting guides is to set each container’s memory limit at about 150 percent of its observed peak. That leaves room for spikes while letting the system kill a runaway container instead of dragging the whole server down.
CPU and disk still matter
Most self-hosted stacks run out of memory before CPU. Still, keep 2 vCPUs as the floor even for light setups. Background OS work, TLS handshakes, and package updates all need a core while traffic spikes hit the other one.
Disk is the quiet killer. Container images, build cache, and logs grow faster than anyone expects, so 40 GB is the practical minimum and 80 GB or more makes sense if you build images on the server. Cap container logs early by setting a global log rotation in the Docker daemon configuration, for example a maximum of 10 MB per log file with three files kept per container. Without that, one chatty container can fill a small disk.
Swap is a safety net, not a plan
Running out of memory is the most common failure in multi-container setups. When it happens, the kernel’s out-of-memory killer picks a process and ends it, which is why a database or a background worker dies at random instead of the app that actually over-ate. A little swap delays the crash and gives you time to react, but a server that lives in swap feels broken. Size the RAM so swap almost never gets used. If you have not set up that safety net yet, our guide to swap on a VPS explains when you need it and how to add it.
A five minute sizing routine
- List every service you will run, including the database, the cache, and the reverse proxy.
- Give each one a memory budget from the table above.
- Add 600 MB for the Docker daemon and the OS.
- Multiply the total by 1.5 and round up to the next available plan.
- Plan to re-check with docker stats after a week and tune the limits.
Most budget providers start their plans at a few dollars a month, so moving up one tier is cheap insurance. Check official pricing before you commit, since prices shift between providers and regions.
FAQ
Is 2 GB of RAM enough for a small self-hosted stack?
Yes, for a handful of light services like a reverse proxy, a password manager, and a monitoring tool. Add a database-backed app like Nextcloud or WordPress and 4 GB becomes the comfortable choice.
Which matters more for Docker, CPU or RAM?
RAM, for almost every home lab stack. CPU only becomes the bottleneck with video transcoding, machine learning workloads like Immich’s facial recognition, or heavy image builds on the server.
Can I resize the VPS later if I get it wrong?
Most providers let you change plans, but it usually needs a reboot and sometimes a full stop and start. Picking one size up at the start costs less than the late-night debugging session when memory runs out.
Size by memory budget, measure the reality with docker stats, and keep headroom for the one service you will inevitably add next month. For most people starting out, the 4 GB tier is the safest first buy.