Azure中的Docker容器/bin/sh: 1: [gunicorn,: not found.]



我有以下问题:

我有一个用Python编写的小web应用程序。我在docker容器中运行它。在本地,web应用运行良好。当我将容器部署到Azure应用程序服务时,我得到以下错误:

2021-09-07T15:11:32.980846527Z /bin/sh: 1: [gunicorn,: not found

这是我的Dockerfile

FROM python:3.8-slim-buster
EXPOSE 5000
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
COPY requirements.txt .
RUN python -m pip install -r requirements.txt
WORKDIR /app
COPY . /app
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "dash_appdashboard:server"]

这是requirements。txt

flask
gunicorn
dash
pandas

我对docker和python很陌生。根据我的理解,pip install应该在容器本身中安装requirements.txt中所有内容的最新版本。我不明白为什么找不到玉米。

任何帮助都将非常感激。

From the docs:

如果您想在没有shell的情况下运行<command>,那么您必须将命令表示为JSON数组并给出可执行文件的完整路径。这种阵列形式是CMD的首选格式。任何额外的参数必须单独表示为数组中的字符串。

也就是说,您应该提供gunicorn可执行文件的完整路径,或者使用shell格式:
CMD gunicorn --bind 0.0.0.0:5000 dash_appdashboard:server

最新更新