Quick answer

When Ollama crashes with llama runner process has terminated: signal: killed (or Docker exit code 137), the Linux kernel OOM killer terminated ollama_llama_server because model weights + KV context cache + Open WebUI exceeded physical RAM. Fix it immediately by capping num_ctx (2048–4096), setting OLLAMA_NUM_PARALLEL=1, switching from Q8_0/fp16 to Q4_K_M, or sizing your VPS RAM properly (8 GB minimum for 7B/8B models, 16 GB for 14B, 32 GB for 32B).

Key takeaways
01

Check dmesg -T | grep -i oom first. That confirms Linux killed the runner rather than a corrupted GGUF file.

02

Context length (num_ctx) is the silent RAM multiplier. Jumping from 2048 to 32768 context alongside OLLAMA_NUM_PARALLEL=4 can add 4–12 GB of KV-cache overhead on top of model weights!

03

Add a 4 GB NVMe swap safety net to survive brief load spikes, though active inference in swap will run 20x slower.

04

Match model size to physical VPS RAM (table below).

We see this exact crash constantly from developers trying to squeeze llama3.1:8b + Docker + Open WebUI onto a 4 GB server (or running qwen2.5:14b on an 8 GB box with a 32k context window).

1. Confirm the Kernel OOM Kill (exit code 137)

Run this on your VPS right after the crash:

sudo dmesg -T | grep -iE 'killed process|out of memory' | tail -n 5
free -h && ollama ps

If you see Out of memory: Killed process ... (ollama_llama_server), your configuration is sound — you simply ran out of memory.

2. Cut Ollama's RAM Footprint by 35–50% (OLLAMA_NUM_PARALLEL & Q4_K_M)

By default, recent Ollama builds pre-allocate parallel request slots (OLLAMA_NUM_PARALLEL=4), multiplying KV-cache memory by 4x! Lock single-user self-hosted instances to 1 slot and Q4_K_M quantization:

# In /etc/systemd/system/ollama.service.d/override.conf (or docker-compose environment)
Environment="OLLAMA_NUM_PARALLEL=1"
Environment="OLLAMA_MAX_LOADED_MODELS=1"
Environment="OLLAMA_FLASH_ATTENTION=1"

And create a capped-context alias if Open WebUI sends huge RAG prompts:

FROM qwen2.5:7b-instruct-q4_K_M
PARAMETER num_ctx 4096

3. Honest VPS RAM Sizing Table (Ollama + Open WebUI in Docker)

Model Tier (`Q4_K_M`)Weights + 4k KV + OS/WebUIMinimum VPS RAMMatching PrivateByte Plan
1.5B – 3B (Llama 3.2 3B, Qwen 2.5 3B)~3.4 GB4 GB VPSOrbit ($7.99/mo)
7B – 8B (Llama 3.1 8B, Qwen 2.5 7B)~6.8 GB8 GB VPSComet ($15.99/mo)
14B (Qwen 2.5 14B, Phi-4 14B)~11.5 GB16 GB VPSPulsar ($27.99/mo)
27B – 32B (Gemma 27B, Qwen 32B)~22.5 GB32 GB VPSQuasar ($49.99/mo)

Underlined = best value in that row. Measured with Ubuntu 24.04 + Docker + Open WebUI + OLLAMA_NUM_PARALLEL=1 (Q4_K_M).

Comparing 16 GB and 32 GB cloud pricing across providers? Check total monthly cost (including bandwidth and backups) in our VPS Price Calculator or follow our full Self-Host Ollama + Open WebUI Guide.