5 hours ago
Project: alluring-perfection
Service: postgres-tools-4Nth (ID: 22d43365-a348-492a-a4a1-42b647a61348)
Environment: production (EU West)
Issue: Container stuck on "Starting Container" / DRAIN_INSTANCES phase across multiple deployment attempts. The deployment build and network configuration complete successfully, but the container never transitions to running state. This has occurred on multiple service instances and redeploys.
Docker Image: postgres:16
Start Command: sh -c 'sleep infinity'
Previous Deployment ID: d2365100-606d-4811-a45c-b72fdbe53d31
Current Deployment ID: Check the latest deployment for postgres-tools-4Nth in the dashboard
Steps Taken:
Created postgres-tools service with postgres:16 image
Configured start command and reference variables to Postgres-78XF
Attempted multiple redeploys and restarts
Deleted and recreated the service
All deployments show SUCCESS status but container never starts
Expected Behavior: Container should transition to running state and be accessible via console
Actual Behavior: Deployment stuck in DRAIN_INSTANCES phase indefinitely
1 Replies
5 hours ago
This thread has been opened as a public bounty so the community can help solve it. The thread and any further activity are now visible to everyone.
Status changed to Open Railway • about 5 hours ago
3 hours ago
Hey @m50s79sm6srnp8jn,
I found the root cause of your deployment getting stuck at `DRAIN_INSTANCES`.
**Problem:** Your custom start command `sh -c 'sleep infinity'` prevents the PostgreSQL server from ever starting. The `postgres:16` image expects `docker-entrypoint.sh postgres` as its entrypoint to initialize and run the database.
**Solution:** Remove or replace the custom start command with the default:
docker-entrypoint.sh postgres
Or simply delete the custom start command entirely and let the image use its default entrypoint.
**Why DRAIN_INSTANCES loops forever:** Railway keeps trying to drain old instances and start new ones, but since `sleep infinity` runs no service on any port, the health checks fail and the deployment never completes.
**Steps to fix:**
1. Go to your service settings
2. Remove `sleep infinity` from Custom Start Command
3. Redeploy
If your goal is a `psql` client/tooling container (not a database server), use a lightweight image like `alpine` with `psql` installed instead of `postgres:16`.
Let me know if it works! 🚀