Home/Blog/DevOps & Cloud
DevOps & Cloud⚡ Intermediate
9 min read
October 05, 2026

How to Run Docker Containers Smoothly on Low-RAM VPS (1GB - 2GB RAM)

Technical Blueprint & Architecture Summary
Target EnvironmentUbuntu 24.04 / Debian 12
Hardware Reqs1 vCPU • 1GB RAM • NVMe
Verification Status Production Tested
🐳
Edutechz Infrastructure Team
DevOps & Systems Engineering
#Docker#Linux VPS#ZRAM#Memory Optimization#DevOps

The Low-RAM Cloud Dilemma

Developers frequently deploy microservices, personal staging sites, VPN nodes, and analytics on entry-level cloud servers with 1GB or 2GB of RAM. However, running standard Docker engines with multiple images can quickly lead to out-of-memory kernel panics (`OOM killer`), terminating critical processes.

With proper swap management, ZRAM in-memory compression, and fine-tuned Docker daemon configurations, a 1GB VPS can comfortably host multiple containerized services.


1. Enable Compressed ZRAM Swap

Traditional disk-based swap files on SSDs introduce I/O latency when memory pressure occurs. **ZRAM** allocates a compressed RAM-block that acts as high-speed swap space with compression ratios up to 3:1.

bash terminal
sudo apt install -y zram-tools

# Configure zram allocation
sudo nano /etc/default/zramswap

Set:

text terminal
ALGO=zstd
PERCENT=50

Restart the service:

bash terminal
sudo systemctl restart zramswap
zramctl

Now, 50% of your physical RAM is available as high-speed compressed swap, effectively providing ~2.5GB of usable memory without disk wear!


2. Configure Docker Daemon Memory Limits

By default, Docker does not restrict log file sizes, and container logs can silently consume hundreds of megabytes of memory and disk space.

Edit or create `/etc/docker/daemon.json`:

json terminal
{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  },
  "storage-driver": "overlay2",
  "live-restore": true
}

Restart Docker:

bash terminal
sudo systemctl restart docker

3. Enforce Strict Cgroup Memory Limits on Containers

Never run containers without memory ceilings on entry-level servers. Always constrain memory allocation in your `docker run` commands or `docker-compose.yml` files:

Docker CLI Example:

bash terminal
docker run -d \
  --name my-web-app \
  --memory="256m" \
  --memory-swap="512m" \
  --cpus="0.5" \
  nginx:alpine

Docker Compose Example:

yaml terminal
version: '3.8'

services:
  database:
    image: postgres:16-alpine
    deploy:
      resources:
        limits:
          memory: 384M
        reservations:
          memory: 128M

  backend:
    image: node:20-alpine
    deploy:
      resources:
        limits:
          memory: 256M

4. Choose Alpine Linux & Multi-Stage Builds

Always favor `alpine` base images over full Ubuntu or Debian distributions:

| Image | Base Size | RAM Footprint |

| :--- | :---: | :---: |

| `node:20` (Debian) | ~1.1 GB | ~120 MB |

| `node:20-alpine` | ~180 MB | ~38 MB |

| `nginx:latest` | ~190 MB | ~35 MB |

| `nginx:alpine` | ~23 MB | ~11 MB |

By switching 4 containers to Alpine, you instantly reclaim hundreds of megabytes of physical RAM.

Deploy On Edutechz NVMe Cloud

Need clean IP addresses, DDoS mitigation, and 10 Gbps uplinks to run your proxies, containers, or Windows servers? Deploy your instance in 60 seconds.

Explore Cloud Plans

Recommended Technical Guides

Networking & Privacy

How to Set Up a High-Performance MTProto Proxy on Ubuntu 24.04 LTS

9 min read
Windows RDP

Step-by-Step Windows RDP Optimization for High-Latency Connections

8 min read
Cybersecurity

Best Practices for Securing Linux Cloud Servers Against Brute-Force Attacks

10 min read