Docker Container Restarting: Crash Loop vs OOM vs Policy

Symptom

docker ps shows the container up but RestartCount climbs.

Root cause

App crashing, OOM kill, or a healthcheck failing on a policy.

Fix, in order

1. Read the last exit and OOM flagdocker inspect <c> --format "{{.State.ExitCode}} {{.State.OOMKilled}} {{.RestartCount}}"
2. Follow the logs of the crashdocker logs --since 5m <c>
3. OOMKilled=true means memory, not codedocker stats --no-stream # right-size -m limit

Prevent it coming back

Healthchecks with sane retries; memory limits from day one.

Deep-dive article

Full walkthrough: Docker Container Restarting: Crash Loop vs OOM vs Policy on the NinjaOps blog.

Run it on clean infra

Spinning up a fresh box to reproduce or escape this error?

Servers with headroom

Related

Cloud & DevOps tool comparisons · Hardware build guides

NinjaOps publishes free engineering guides. Some outbound links are affiliate links: they cost you nothing and support the site.

Last reviewed 2026-10-02 · NinjaOps SEO grid · DevOps blog