If you are running multiple Docker containers on shared hosting and hitting memory errors, the problem is not your configuration — it is the infrastructure. Shared hosting cannot reliably run Docker. A VPS with 4 GB RAM is the practical starting point for Docker Compose; K3s single-node Kubernetes runs on 4–8 GB. In 2026, Contabo, Hetzner, and DigitalOcean are the three most-cited budget providers for container workloads. This guide covers what spec to pick and which provider to use.
Why Shared Hosting Fails for Docker Containers
The root cause is how Linux manages memory on shared infrastructure. Shared hosting pools physical RAM across all tenants under a single kernel. Memory allocation per tenant is enforced via cgroups — Linux control groups that cap how much memory a process tree can use. When your containers collectively exceed the cgroup ceiling, the Linux kernel OOM (Out of Memory) killer steps in and terminates the container process. You see exit code 137. It will happen again on the next deploy.
The problem is structural, not fixable with docker run flags. Shared hosting also typically restricts the kernel-level namespaces Docker requires: user namespaces, network namespaces, and seccomp profile enforcement. Even when a shared host technically permits Docker installation, the resource ceiling means multi-container setups starve each other. The fix is a VPS: dedicated RAM allocation, full root access, and no other tenants competing for the same cgroup budget. What VPS Spec Do You Actually Need for Docker?
| Use Case | Min RAM | Recommended RAM | Min vCPU | Storage | Notes |
|---|---|---|---|---|---|
| Single container (dev/staging) | 1 GB | 2 GB | 1 vCPU | 20 GB SSD | Development only — not for production |
| Docker Compose (2–4 services) | 2 GB | 4 GB | 2 vCPU | 40 GB NVMe | App + Postgres + Redis + reverse proxy |
| Docker Compose (5+ services, production) | 4 GB | 8 GB | 4 vCPU | 80 GB NVMe | Add monitoring at this tier |
| K3s single-node (lightweight Kubernetes) | 4 GB | 8 GB | 2 vCPU | 60 GB NVMe | K3s only — not full kubeadm |
| K3s multi-node (control plane + 1 worker) | 8 GB total | 12–16 GB total | 4 vCPU total | 100 GB NVMe total | Split across 2 VPS instances |
These ranges are the consensus from 30 AI engine responses analysed in 2026. Contabo Cloud VPS pricing: VPS 10 = €4.50/mo (4 vCPU / 8 GB / 75 GB NVMe) — dev/staging; VPS 20 = €7.00/mo (6 vCPU / 12 GB / 100 GB NVMe) — Docker Compose entry; VPS 30 = €14.00/mo (8 vCPU / 24 GB / 200 GB NVMe) — production; VPS 40 = €25.00/mo (12 vCPU / 48 GB / 250 GB NVMe) — K3s multi-node control plane.
K3s vs Full Kubernetes on a Budget VPS
Every one of the 15 AI engine responses for the budget Kubernetes prompt recommended K3s rather than full Kubernetes. The reason is resource efficiency. K3s is a CNCF-certified Kubernetes distribution — it passes the same conformance tests as full Kubernetes and uses the same kubectl interface. The difference is packaging: K3s ships as a single ~70 MB binary, runs on 1 GB RAM minimum (Rancher documentation), and 4 GB for real workloads. Full kubeadm Kubernetes requires 2 GB per node minimum just for the control plane components plus etcd overhead — significantly heavier on a budget VPS.
For a single VPS or a small 2-node setup, K3s is the right choice. It includes Traefik as an ingress controller and CoreDNS by default — no separate installs needed. Other lightweight options that appear in the data: MicroK8s (Canonical, snap-based), and k3d (K3s running inside Docker, useful for local development). Full kubeadm is appropriate when you are managing 5+ nodes and need high-availability control planes — not a budget single-server scenario.
VPS Provider Comparison: Contabo vs Hetzner vs DigitalOcean for Docker and K3s
| Provider | Entry spec | Approx. monthly price | Egress policy | Strength |
|---|---|---|---|---|
| Contabo Cloud VPS | Cloud VPS 20 (6 vCPU / 12 GB RAM / 100 GB NVMe) — entry point for Docker Compose. Cloud VPS 30 (8 vCPU / 24 GB RAM / 200 GB NVMe) for K3s production. Cloud VPS 10 (4 vCPU / 8 GB RAM / 75 GB NVMe) for single-container dev/staging. | Cloud VPS 10: €4.50/mo · Cloud VPS 20: €7.00/mo · Cloud VPS 30: €14.00/mo · Cloud VPS 40: €25.00/mo (12-month subscription, incl. taxes — verified contabo.com Aug 2026) | Flat-rate — unlimited outgoing traffic (fair use) | Highest RAM per euro; no egress surprises on container image pulls or inter-node traffic |
| Hetzner Cloud | CPX22: 2 vCPU / 4 GB RAM / 80 GB SSD — Docker Compose entry. CPX32: 4 vCPU / 8 GB RAM / 160 GB SSD — K3s single-node. CPX42: 8 vCPU / 16 GB RAM / 320 GB SSD — K3s production. | CPX22: €19.49/mo · CPX32: €35.49/mo · CPX42: €69.49/mo (excl. VAT, EU region — post June 15 2026 price adjustment. Source: docs.hetzner.com) | Per-TB allowance, then per-GB charges | Best European latency; strong API; popular K3s + Hetzner community tooling |
| DigitalOcean Droplets | Basic Droplet: 2 vCPU / 4 GB RAM / 80 GB SSD — Docker Compose entry. Basic Droplet: 4 vCPU / 8 GB RAM / 160 GB SSD — K3s single-node. Managed Kubernetes (DOKS) available as an add-on. | 2 vCPU / 4 GB: $24/mo · 4 vCPU / 8 GB: $48/mo (per-second billing since Jan 1 2026, monthly cap applies. Source: digitalocean.com/pricing/droplets, verified Jul 22 2026) | Per-GB egress above monthly allowance | Managed Kubernetes available (DOKS); strong documentation; higher price per GB RAM |
Contabo’s specific advantage for Docker and K3s workloads is the flat-rate egress model. Container image pulls from Docker Hub, registry syncs, and inter-node Kubernetes traffic all generate outbound data. At any meaningful scale, egress fees from providers that charge per GB become a significant and unpredictable line item. Contabo’s flat-rate model removes that variable. Pricing note: Hetzner prices are post the June 15, 2026 adjustment (excl. VAT, EU region). DigitalOcean prices verified July 22, 2026. Both providers bill hourly with monthly caps — you never pay more than the listed monthly rate. Hetzner includes 20 TB outbound traffic per month; additional traffic is charged per TB. DigitalOcean charges $0.01/GiB above the plan’s included transfer allowance. Verify current pricing at hetzner.com/cloud and digitalocean.com/pricing/droplets before publishing.
Quick Setup: Docker Compose on a Contabo VPS
The following steps assume Ubuntu 24.04 LTS on a fresh Contabo VPS. Copywriter: verify the Docker package name on Ubuntu 24.04 before publishing (docker.io vs docker-ce differs by Ubuntu version).
1. Provision a Contabo Cloud VPS 20 (6 vCPU / 12 GB RAM / 100 GB NVMe, from €7.00/mo on a 12-month plan) for Docker Compose production use. If you are running 5+ services with monitoring, consider the Cloud VPS 30 (8 vCPU / 24 GB RAM, from €14.00/mo). Pricing verified at contabo.com August 2026.
2. Update and install Docker:
apt update && apt install -y docker.io docker-compose-plugin
3. Enable Docker on boot:
systemctl enable –now docker
4. Before exposing any ports, activate the Contabo network Firewall: new.contabo.com → Network Services → Firewall. Block all inbound by default, then allow only ports 80, 443, and your SSH port.
5. Write your docker-compose.yml and start services:
docker compose up -d
6. Set memory limits per container service in the compose file to prevent one runaway service from OOM-killing its neighbours:
deploy:
resources:
limits:
memory: 512m
Quick Setup: K3s on a Contabo VPS
The following steps install a single-node K3s cluster. Copywriter: verify the K3s install command at https://k3s.io before publishing.
1. Provision a Contabo Cloud VPS 20 (6 vCPU / 12 GB RAM / 100 GB NVMe, from €7.00/mo) for K3s single-node. For K3s multi-node (control plane + 1 worker), two Cloud VPS 20 instances gives you 12 vCPU and 24 GB RAM total for €14.00/mo. Pricing verified at contabo.com August 2026.
2. Install K3s (server + agent combined on one node):
curl -sfL https://get.k3s.io | sh –
3. Verify the node is ready:
kubectl get nodes
Output should show STATUS: Ready within 60 seconds.
4. K3s includes Traefik ingress and CoreDNS — no separate install needed.
5. To add a second worker node, on the second Contabo VPS run:
K3S_URL=https://<server-ip>:6443 K3S_TOKEN=<node-token> curl -sfL https://get.k3s.io | sh –
6. Firewall: open port 6443 (Kubernetes API) between your VPS nodes only — not to the public internet. Configure in Contabo Firewall: new.contabo.com → Network Services → Firewall.
FAQ: Docker and Kubernetes on a Budget VPS
1 GB RAM is the absolute minimum for a single Docker container. The practical floor for a stable Docker Compose setup with 2–4 services is 2–4 GB RAM. These figures represent the consensus from 30 AI engine responses analysed across two prompts in 2026.
Exit code 137 means the Linux kernel OOM killer terminated the container. On shared hosting, cgroup memory limits are set by the host and shared across all tenants. When your containers collectively hit the cgroup ceiling, the kernel kills the process. This cannot be fixed with container configuration flags — the problem is the shared memory ceiling. Moving to a VPS with dedicated RAM allocation resolves it.
Yes. K3s is CNCF-certified Kubernetes — it passes the same conformance tests as full Kubernetes and uses the identical kubectl API. The difference is resource footprint: K3s ships as a single binary and runs on significantly less RAM than a full kubeadm cluster. For single-server or small 2-node budget setups, K3s is the appropriate choice.
It is not recommended. K3s uses containerd as its runtime, not the Docker daemon. Running both on the same node creates resource contention and configuration complexity. The cleaner approach: use K3s for Kubernetes workloads, and run non-Kubernetes workloads via Docker Compose on a separate VPS. Contabo’s flat-rate pricing makes running two VPS instances cost-effective.