Estoy tratando de ejecutar fastapi en docker pero recibo un error. Estoy usando docker run -d -p 8080:8080 onetest para ejecutar el contenedor. No pude corregir este error. Cuando ejecuto la aplicación sin la ventana acoplable localmente, no tengo ningún problema. Tengo este problema al ejecutar fastapi con docker.
gunicorn_config.py
bind = "0.0.0.0:8080" workers = 4 timeout = 300 worker_class = "uvicorn.workers.UvicornWorker" Dockerfile
FROM tiangolo/uvicorn-gunicorn:python3.8-slim COPY ./requirements.txt ./requirements.txt RUN pip3 install --no-cache-dir --upgrade -r ./requirements.txt COPY ./app ./app COPY ./inputs ./inputs COPY ./model ./model COPY ./tests ./tests COPY ./gunicorn.config.py ./gunicorn.config.py COPY ./Procfile ./Procfile COPY ./entrypoint.sh ./entrypoint.sh RUN chmod +x entrypoint.sh CMD [ "./entrypoint.sh" ] entrypoint.sh
#!/bin/bash gunicorn --worker-tmp-dir /dev/shm --config gunicorn.config.py app.main:app During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/bin/gunicorn", line 8, in <module> sys.exit(run()) File "/usr/local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 67, in run WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run() File "/usr/local/lib/python3.8/site-packages/gunicorn/app/base.py", line 231, in run super().run() File "/usr/local/lib/python3.8/site-packages/gunicorn/app/base.py", line 72, in run Arbiter(self).run() File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 229, in run self.halt(reason=inst.reason, exit_status=inst.exit_status) File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 342, in halt self.stop() File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 393, in stop time.sleep(0.1) File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 242, in handle_chld self.reap_workers() File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 525, in reap_workers raise HaltServer(reason, self.WORKER_BOOT_ERROR) gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>