ErrorDocker
Container keeps restarting / restart loop
If the OpenClaw container crashes on startup and Docker's restart policy keeps bringing it back, you'll see it cycling between 'restarting' and 'running'. The root cause is usually a configuration problem.
Symptoms
- •
docker compose ps shows 'restarting' status - •
Logs show a crash followed by immediate restart - •
Container uptime resets every few seconds - •
High CPU usage from repeated startups
Causes
- •Invalid or missing API key (OpenAI, Anthropic, etc.)
- •Required environment variables are missing from .env
- •Out of memory (OOM) — server doesn't have enough RAM
- •Syntax error in docker-compose.yml
- •Corrupted Docker image or volume
Solution
Check the logs
This is always the first step — the logs tell you exactly what's wrong:
docker compose logs openclaw --tail 50
Look for error messages near the end — they'll point to the specific issue.
Common fixes
Missing env vars: Check that your .env file has all required variables:
cat .env
Out of memory: Check available RAM:
free -h
If you have less than 1 GB free, add swap:
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
Bad docker-compose.yml: Validate the syntax:
docker compose config
Nuclear option — clean restart
If nothing else works, remove the container and its volumes and start fresh:
docker compose down -v
docker compose pull
docker compose up -d