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.
More on Resources, health checks, logging and restarts
Container restarts repeatedly: `docker ps` shows `Restarting (1) 5 seconds ago`.Beginner`OOMKilled: true` and exit code 137.BeginnerContainer is `unhealthy` but the app works when tested manually.Intermediate`docker stats` shows 100%+ CPU and the container is slow.Intermediate`docker logs` is slow or `docker logs -f` hangs on a container with huge logs.Intermediate`Error response from daemon: configured logging driver does not support reading` when running `docker logs`.Intermediate