# Fix Blockscout Container Restart Issue **Issue**: Blockscout container is restarting repeatedly **Status**: Diagnosing... --- ## Quick Fix Commands Run these in your SSH session to the container: ```bash # 1. Check logs to see error docker logs --tail 50 blockscout # 2. Stop containers cd /opt/blockscout # or /root/blockscout docker-compose down # 3. Verify PostgreSQL is ready docker exec blockscout-postgres pg_isready -U blockscout # 4. Test RPC connectivity curl -X POST http://192.168.11.250:8545 \ -H 'Content-Type: application/json' \ -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' # 5. Check docker-compose.yml for issues cat docker-compose.yml | grep -A 5 "blockscout:" # 6. Ensure SECRET_KEY_BASE is set (not using $()) SECRET_KEY=$(openssl rand -hex 64) sed -i "s|SECRET_KEY_BASE=.*|SECRET_KEY_BASE=${SECRET_KEY}|" docker-compose.yml # 7. Remove any command overrides sed -i '/^\s*command:/d' docker-compose.yml sed -i '/^\s*entrypoint:/d' docker-compose.yml # 8. Restart docker-compose up -d docker logs -f blockscout ``` --- ## Common Issues and Fixes ### Issue 1: SECRET_KEY_BASE Not Generated **Fix:** ```bash SECRET_KEY=$(openssl rand -hex 64) sed -i "s|SECRET_KEY_BASE=.*|SECRET_KEY_BASE=${SECRET_KEY}|" docker-compose.yml ``` ### Issue 2: Database Not Ready **Fix:** ```bash # Wait for PostgreSQL docker exec blockscout-postgres pg_isready -U blockscout # If not ready, restart postgres docker-compose restart postgres ``` ### Issue 3: RPC Endpoint Not Accessible **Fix:** ```bash # Test RPC curl -X POST http://192.168.11.250:8545 \ -H 'Content-Type: application/json' \ -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' ``` ### Issue 4: Command Override in docker-compose.yml **Fix:** ```bash # Remove command/entrypoint overrides sed -i '/command:/d' docker-compose.yml sed -i '/entrypoint:/d' docker-compose.yml docker-compose up -d blockscout ``` --- **Run the diagnosis script first to identify the specific issue!**