← Back to all
Stability· 7 min read · Updated 2026-12-01

Stop OOM Freezes on 4–8 GB NAS Boxes

How Linux OOM kills containers (or freezes SSH completely), how to size mem_limit, and the exact environment variables that tame Immich and Paperless.

1. Budget for peak, not idle

An app that idles at 250 MB can spike to 1.5 GB the moment you upload 500 photos or scan a 100-page PDF. Once RAM fills up and swap thrashes on spinning HDDs, even SSH stops responding.

2. Put mem_limit on every single service

Set mem_limit to roughly 1.2× each service’s expected peak. If one container leaks or spikes, Docker restarts that container instead of taking down the whole NAS.

services:
  paperless-webserver:
    mem_limit: 1536m
    environment:
      - PAPERLESS_TASK_WORKERS=1
      - PAPERLESS_THREADS_PER_WORKER=1

3. Verify with docker stats

After deploying, run docker stats --no-stream both at idle and during a heavy job (like Immich initial import). Share your measured numbers on NASPicks to help others on the same hardware.

docker stats --no-stream --format "table {{.Name}}\t{{.MemUsage}}\t{{.MemPerc}}"

Comments (GitHub Discussions)

GitHub Discussions ↗

Comments load lazily to keep pages fast everywhere.