a year ago
Hi guys,
even though I have a solid Dockerfile and the deployment is successful the app respond with the Application failed to respond screen when it should be responding with a server is running message.
Do I need a different start command?
Here is my Dockerfile:
# Use Python 3.12 slim image as base
FROM python:3.12-slim
# Set working directory
WORKDIR /app
# Upgrade pip and install build tools
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Create necessary directories
RUN mkdir -p /var/data
# Copy the rest of the application
COPY . .
# CMD will use PORT from environment or default to 8000
CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port ${PORT:-8000}"]3 Replies
a year ago
Hello,
Please see our docs on this topic -
https://docs.railway.com/reference/errors/application-failed-to-respond
Best,
Brody
Status changed to Awaiting User Response Railway • about 1 year ago
a year ago
Thanks Brody,
for people struggling with that make sure to add a
Custom Start Command available in the Deploy section of your settings mine was as below:
uvicorn app:app --host 0.0.0.0 --port 8000 <-- the port (8000) needs to match the one your networking settings.
Status changed to Awaiting Railway Response Railway • 12 months ago
a year ago
That or make your target port match the port your app was already running on!
Status changed to Awaiting User Response Railway • 12 months ago
Status changed to Solved brody • 12 months ago