App Unhealthy Restart Loop Playbook
Who this is for
Users whose Docker container app or Compose app shows a status of failed, is stuck in a restart loop, or passes the health check intermittently.
Step 1 — Read the App Logs
App logs are the first diagnostic tool:
- Open App detail → Logs tab.
- Read the most recent output.
Look for:
- Application startup errors (crash on boot, missing env vars, DB connection failed)
- OOM (Out of Memory) — container killed by kernel:
killed,OOM,exit code 137 - Port binding errors —
EADDRINUSE,address already in use,bind: address already in use - Missing environment variables —
undefined,env: ...not found
Step 2 — Check the Health Check Configuration
If the app passes the health check on startup but then fails:
- Open App detail → Settings (or edit the app).
- Review the Health check settings:
- Path — the HTTP path the health check hits (e.g.,
/health) - Port — the port the health check uses
- Test the health check manually:
curl http://<server-ip>:<port>/health
If the health check path does not exist in your app, the container will always appear unhealthy. Either:
- Add a
/healthendpoint to your app. - Update the health check path to one that exists.
- Disable the health check if your app does not support one.
See KB-04-13: Healthcheck Behavior.
Step 3 — Diagnose the Restart Loop
A restart loop means the container is crashing on startup and Docker is restarting it (based on restartPolicy).
Most common causes:
| Cause | Log signal | Fix |
|---|---|---|
| Missing environment variable | Cannot read property ... of undefined or env: VAR not found | Add missing env var — see KB-04-08 |
| Database not reachable | ECONNREFUSED, Connection refused | Check DB host/port; check DB is running |
| Port already in use | EADDRINUSE, bind: address already in use | See KB-12-15: Port Conflict Playbook |
| App crashes on startup | Stack trace ending with process exited with code 1 | Fix the application error shown in the trace |
| Out of memory | exit code 137, Killed | Increase server RAM or reduce app memory usage |
| Wrong image / bad tag | No such image: ..., manifest unknown | Pull the correct image; verify the tag exists |
Step 4 — Stop the Restart Loop While You Fix
- Open App detail.
- Click Stop to halt the container.
This stops the restart loop and gives you time to fix the issue without resource exhaustion.
Step 5 — Fix and Redeploy
After fixing the root cause:
- Update env vars, image tag, or health check config.
- Click Deploy (or Start) to restart the app.
- Watch the Logs tab to confirm startup succeeds.
Related Articles
- KB-04-12: Read App Logs and Diagnose Failed Startup
- KB-04-13: Healthcheck Behavior
- KB-12-15: Port Conflict Playbook