All articles
DockerProductionGuide

Docker in production on a VPS: our recommendations

Published on November 18, 2024 · 11 min read

Docker in production on a VPS: our recommendations

Over 60% of our customers run Docker on their VPS. Here are the practices we recommend after five years of watching thousands of setups — including the ones that end badly.

The foundation: a clean, up-to-date OS

Ubuntu 24.04 LTS or Debian 12, current kernel, nothing else. Avoid "all-in-one" images: the smaller the surface, the simpler the updates.

Settings that change everything

Cap log rotation. Docker's defaults can fill a disk within a week:

{
  "log-driver": "json-file",
  "log-opts": { "max-size": "10m", "max-file": "3" }
}

Reserve memory for the system. On an 8 GB VPS, don't let containers eat everything:

docker run --memory=1g --memory-swap=1g ...

docker compose for everything. Even a single container. Reproducibility beats the brevity of a one-liner.

Backups: the classic weak point

Docker volumes aren't backed up by magic. Our recommendation: daily hypervisor-level snapshots (included in our plans) plus application-level exports (SQL dumps, file exports) to external storage.

Minimum monitoring

A casual docker stats isn't enough in production. Install at least Netdata or a Prometheus + Grafana pair in a dedicated container, with alerts on memory and disk.

Conclusion

Docker on a VPS is an excellent choice — as long as you treat the container layer as a first-class production component: limits, logs, backups, monitoring.