3 months ago
My FastAPI backend deploys successfully on Railway. The logs show:
INFO: Uvicorn running on http://0.0.0.0:${PORT}
GET /health 200 OK
But then Railway logs:
Stopping Container
Application shutdown complete.
This happens shortly after a successful health check, even though the app responds correctly and I can access / and /health publicly.
My setup:
- Root directory: backend
- backend/main.py defines FastAPI app
- Procfile: web: uvicorn main:app --host 0.0.0.0 --port $PORT
- railway.json startCommand: uvicorn main:app --host 0.0.0.0 --port $PORT
Looks correct but Railway still shuts the container. Is this a misclassification as a job instead of web service?
2 Replies
Status changed to Awaiting Railway Response Railway • 3 months ago
3 months ago
you should delete the Procfile and ensure your service has a Public Domain generated in the Railway dashboard. This forces Railway to recognize the container as a persistent Web Service rather than a temporary task.
Does your Railway dashboard show a "Public Domain" link for this specific service?
3 months ago
You see "stopping container" because of zero-downtime deployments. Railway is just shutting down your previous deployment right after your new deployment successfully started and passed its health check.