tiangolo / uvicorn-gunicorn-fastapi-docker

Docker image with Uvicorn managed by Gunicorn for high-performance FastAPI web applications in Python with performance auto-tuning.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Container fails silently after a while

sderuiter opened this issue · comments

I'm using this image as a base for my container, DockerFile is:
`#
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9

WORKDIR /code

COPY ./requirements.txt /code/requirements.txt

RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

COPY ./app /code/app
COPY ./app/templates/ /code/app/templates/
COPY ./app/static/ /code/app/static/

CMD ["uvicorn", "app.main:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "80"]
`

This is built and pushed to docker hub.

Now, I run an Unraid server with a Docker service, with NginxProxyManager to handle Nginx.

I have 2 containers:

  • PROD (pulling this image), on port 9999.
  • DEV (pulling this image), on port 10000.

PROD docker command:
root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker run -d --name=‘prod’ --net='bridge' -e TZ="Europe/Berlin" -e HOST_OS="Unraid" -p '9999:80/tcp' 'dockerhubname/myimage:main'

DEV docker command:
root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker run -d --name='dev' --net='bridge' -e TZ="Europe/Berlin" -e HOST_OS="Unraid" -p '10000:80/tcp' 'dockerhubname/myimage:main'

Now this issue. DEV is receiving a few hits from me for testing, works perfectly and never fails.
PROD receives hits, but invariably, after some time, with no indication in the logs, fails. A request will receive a 504 Gateway Timeout. Only way to revive the container is to restart.

How would I even begin to debug this? Any pointers?