The best VPS for Docker: what actually matters
There is no single best VPS for Docker, but there are clear ways to get it wrong. Docker needs certain things from the virtual machine beneath it, and a few of its default behaviours catch out almost everyone the first time.
Check the virtualization type first
Choose a VPS with full virtualization, usually KVM, so that you get your own kernel. On container-based virtualization such as OpenVZ or LXC, Docker may be limited, or may not run properly at all, because your server shares its kernel with the host. If a plan doesn't say what it uses, ask before you buy.
Size the memory from what you run
Add up what your containers use under normal load, then add room for the operating system, for Docker itself and for peaks. Databases and JVM-based applications tend to be the largest. Measure instead of guessing: docker stats shows real usage per container.
Set memory limits on containers in your Compose file, so that one misbehaving service can't take down the others.
Disk matters more than you'd expect
Docker images, layers, volumes and logs all land on disk, and databases are sensitive to its speed. NVMe storage makes builds and database workloads noticeably more comfortable. Leave a generous margin of space too, because a full disk is among the most common reasons for a Docker host to stop working.
The defaults that catch people out
Whichever VPS you choose, deal with these on the first day:
- Published ports can bypass your firewall. On Linux, Docker manages its own iptables rules, so a port published with
-pmay be reachable even when ufw appears to block it. Bind internal services to 127.0.0.1, or use a reverse proxy. - Container logs can grow without limit. Set
max-sizeandmax-filefor the logging driver. - The docker group is effectively root. Only add people you would trust with root access.
- Unused images and volumes pile up. Clean them on purpose, and be careful with volumes, because that's where data lives.
- Back up volumes and databases properly. A snapshot of a running database isn't always a consistent backup.
A simple setup that lasts
For most small projects, Docker Compose behind a reverse proxy such as Nginx, with automatic TLS certificates, restart policies and scheduled off-site backups, is plenty. It's easy to understand, easy to document and easy to rebuild on another server. Start there, and add complexity only when a real problem demands it.
Common questions
- How much RAM do I need for Docker?
- It depends entirely on your containers. Measure them with docker stats, add headroom for the system and for peaks, and upgrade when real usage says so. Most VPS plans make it easy to move up.
- Why is my container reachable even though my firewall blocks the port?
- On Linux, Docker writes its own iptables rules for published ports, which can bypass tools like ufw. Bind the port to 127.0.0.1 and put a reverse proxy in front of it, or use the DOCKER-USER chain for your rules.