【发布时间】:2020-10-18 08:36:06
【问题描述】:
这是我的 dockerfile。我正在尝试使用以下两个命令将此图像部署到谷歌云运行
1. gcloud builds submit --tag gcr.io/smartshop-292203/data_science --timeout=20h0m0s
2. gcloud run deploy --image gcr.io/smartshop-292203/data_science --platform managed
我正在使用这个参考链接
https://cloud.google.com/run/docs/quickstarts/build-and-deploy#python
Dockerfile:
FROM python:3.8
# Allow statements and log messages to immediately appear in the Knative logs
ENV PYTHONUNBUFFERED True
# Copy local code to the container image.
ENV APP_HOME /app
WORKDIR $APP_HOME
COPY . ./
# update image and install cmake
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install cmake -y
RUN apt-get install libgl1-mesa-glx -y
# Install production dependencies.
RUN pip install -r requirements.txt
# command to run on container start
# CMD [ "python", "./app.py" ]
# CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app
CMD exec gunicorn --bind :8001 --workers 1 --threads 8 --timeout 1500 main:app
# CMD exec gunicorn main:app --bind 0.0.0.0:8080 --worker-class aiohttp.GunicornWebWorker
# CMD exec gunicorn --bind 0.0.0.0:8080 wsgi:main
# CMD ["/bin/bash"]
我遇到的错误:
"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 58, in run
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
File "/usr/local/lib/python3.8/site-packages/gunicorn/app/base.py", line 228, 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 227, in run
self.halt()
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>"
会有什么问题? 请看一下
【问题讨论】: