3 months ago
I am trying to deploy a web service app which uses React and Vite. I am getting this error and can't figure out why it's failing. Build is working fine though. The app works fine on my local machine with Docker.
2026-03-06T00:33:30.623048692Z [inf] [stage-1 6/6] RUN sed -i 's/\r$//' /docker-entrypoint.sh && chmod +x /docker-entrypoint.sh
2026-03-06T00:33:30.625248139Z [inf] [stage-1 6/6] RUN sed -i 's/\r$//' /docker-entrypoint.sh && chmod +x /docker-entrypoint.sh
2026-03-06T00:33:30.626530202Z [inf] exporting to docker image format
2026-03-06T00:33:30.626567401Z [inf] exporting to image
2026-03-06T00:33:38.061023708Z [inf] [auth] sharing credentials for production-europe-west4-drams3a.railway-registry.com
2026-03-06T00:33:38.061095892Z [inf] [auth] sharing credentials for production-europe-west4-drams3a.railway-registry.com
2026-03-06T00:33:40.278711481Z [inf] importing to docker
2026-03-06T00:33:42.940660767Z [inf] importing to docker
2026-03-06T00:33:43.121519682Z [inf] [92mBuild time: 21.95 seconds[0m
2026-03-06T00:33:48.264052675Z [inf]
2026-03-06T00:33:48.264120010Z [inf] =========================
2026-03-06T00:33:48.264129041Z [inf] Container failed to start
2026-03-06T00:33:48.264135003Z [inf] =========================
2026-03-06T00:33:48.264164827Z [inf]
2026-03-06T00:33:48.264170065Z [inf] Failed to start deployment.
Can someone give me an insight. I tried many things and nothing is working.
Pinned Solution
3 months ago
The container builds successfully but fails at runtime because no long-running process starts. A Vite build only generates static files and exits, which causes the container to stop immediately. Railway expects the container to run a persistent process listening on $PORT. The fix is to serve the built dist directory using something like serve -s dist -l $PORT or vite preview --port $PORT.
2 Replies
Status changed to Awaiting Railway Response Railway • 3 months ago
3 months ago
The container builds successfully but fails at runtime because no long-running process starts. A Vite build only generates static files and exits, which causes the container to stop immediately. Railway expects the container to run a persistent process listening on $PORT. The fix is to serve the built dist directory using something like serve -s dist -l $PORT or vite preview --port $PORT.
jmenichole
The container builds successfully but fails at runtime because no long-running process starts. A Vite build only generates static files and exits, which causes the container to stop immediately. Railway expects the container to run a persistent process listening on $PORT. The fix is to serve the built dist directory using something like serve -s dist -l $PORT or vite preview --port $PORT.
3 months ago
I have changed Dockerfile to use serve to run instead of the ngnix and that helped fix the issues. Thanks much for the quick suggestion.
Status changed to Solved brody • 3 months ago