R
Railway13mo ago
Logan

Logs blank when deploying with docker container

When I deploy a python project normally, the logs output correctly, however when I use the docker container I've built to deploy the project the logs are missing, does anyone know what could be happening? The docker container is as follows:
FROM python:3.10-slim-buster

WORKDIR /app

COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt

COPY . .

CMD ["python", "main.py"]
FROM python:3.10-slim-buster

WORKDIR /app

COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt

COPY . .

CMD ["python", "main.py"]
Solution:
Figured it out, I needed to add a -u flag to my python run command for unbuffered logs
Jump to solution
4 Replies
Percy
Percy13mo ago
Project ID: 6faf4c55-b612-44fb-9f25-1ae86f7c17be
Logan
Logan13mo ago
6faf4c55-b612-44fb-9f25-1ae86f7c17be This might just be a docker problem actually, not a railway problem. I tried running the dockerfile locally and same issue
Solution
Logan
Logan13mo ago
Figured it out, I needed to add a -u flag to my python run command for unbuffered logs
Brody
Brody13mo ago
btw nixpacks sets the un-buffered variable by default, that's why it worked with nixpacks and not your dockerfile