Docker container keeps restarting (Restarting (1) x seconds ago)
The container crashes on start and its restart policy (always/unless-stopped/on-failure) starts it again in a loop.
Restarting (1)container keeps restartingRestarting (137)restart loop Meaning
docker ps shows Restarting (exit code) and the restart count climbs. The cause is whatever makes the main process exit: missing env vars, DB not reachable yet, bad config, port conflict inside the container, or OOM.
Common causes
- App crashes on startup (config, env, missing file)
- Dependency (database) not ready
- Out of memory (exit 137)
- Wrong command/entrypoint
⚡ Quick fix
- Read logs: docker logs --tail 100 c
- Check exit code and OOMKilled in docker inspect
- Temporarily set restart: "no" and run interactively
Detailed fix by platform
Docker
- bash
docker inspect -f '{{.State.ExitCode}} OOM={{.State.OOMKilled}} restarts={{.RestartCount}}' web docker logs --tail 100 web
How to diagnose
- Exit code — 1 app error, 127 command, 137 OOM
- Logs — Error before each restart
- Dependencies — Is the DB up?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Docker
- docker-credential-desktop error getting credentials - err: exec: "docker-credential-desktop": executable file not found in $PATH
- did not complete successfully failed to solve: process "/bin/sh -c ..." did not complete successfully: exit code: 1
- lookup registry-1.docker.io: no such host dial tcp: lookup registry-1.docker.io: no such host / Temporary failure in name resolution during docker build
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 13 Oct 2026