Interview Prep/Docker/Resources, health checks, logging and restarts

Node.js container OOM despite `--memory 512m`: V8 heap default is larger.

IntermediateTroubleshootingResources, health checks, logging and restarts
Answer

Likely causes → V8 sizes heap from available memory/limits and Buffers live outside heap; default old-space can exceed the limit.

Diagnose → docker exec c node -e "console.log(v8.getHeapStatistics().heap_size_limit/1048576)".

Fix → NODE_OPTIONS=--max-old-space-size=384 (about 75% of limit), watch RSS.

Prevent → Set heap flags together with limits.

All Docker questions Roadmap: Docker & containers

More on Resources, health checks, logging and restarts