Docker Compose on a 1 GiB VPS: what actually fits, and how to keep it up
Description and use
On a 1 GiB VPS, Docker Compose can run reliably by installing the official Docker Engine, adding swap, setting per‑service memory limits, configuring log rotation, and pinning image tags. Use a dedicated IPv4 for HTTPS with Caddy.
Problem
Running Docker Compose on a 1 GiB VPS leads to OOM kills and disk exhaustion because containers lack memory limits, swap, log rotation, and image pinning.
Outcome
The VPS runs Docker Compose reliably: containers stay within memory limits, swap prevents abrupt OOM kills, logs stay bounded, and images are reproducible. Reverse proxy works only with a dedicated IPv4 or is omitted for non‑browser services.
Workflow
- Install Docker Engine from official repo and docker‑compose‑plugin
- Add current user to docker group and start new shell
- Create 2 GiB swapfile and set vm.swappiness=10
- Configure /etc/docker/daemon.json with log‑driver limits
- Restart docker daemon and recreate containers
- Add mem_limit and memswap_limit to each service in compose file
- Pin image tags (or digests) in compose file
- If needed, obtain dedicated IPv4 or skip reverse proxy
Evidence
Docker itself is not the problem on a 1 GiB box — the daemon idles under 50 MB.
Add a swap file before you add containers
Give every service a memory limit
Log rotation, or the disk fills quietly
- Record date: 2026-09-21T01:15:28.223Z