python - standard_init_linux.go :211: exec user process caused "no such file or directory"?

标签 python django docker dockerfile entry-point

Docker文件

FROM python:3.7.4-alpine

ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV LANG C.UTF-8
MAINTAINER "mail@gmail.com"


RUN apk update && apk add postgresql-dev gcc musl-dev
RUN apk --update add build-base jpeg-dev zlib-dev
RUN pip install --upgrade setuptools pip

RUN mkdir /code
WORKDIR /code

COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/

#CMD ["gunicorn", "--log-level=DEBUG", "--timeout 90", "--bind", "0.0.0.0:8000", "express_proj.wsgi:application"]
ENTRYPOINT ["./docker-entrypoint.sh"]

docker-entrypoint.sh
#!/bin/bash

# Prepare log files and start outputting logs to stdout
touch /code/gunicorn.log
touch /code/access.log
tail -n 0 -f /code/*.log &

# Start Gunicorn processes
echo Starting Gunicorn.
exec gunicorn express_proj.wsgi:application \
    --name express \
    --bind 0.0.0.0:8000 \
    --log-level=info \
    --log-file=/code/gunicorn.log \
    --access-logfile=/code/access.log \
    --workers 2 \
    --timeout 90 \
    "$@"
遇到错误
standard_init_linux.go:211:exec用户进程导致“没有这样的文件或目录”
需要帮忙。
有人说要使用dos2unix(我不知道要用它。)

最佳答案

脚本开头的“shebang”行说明了用于运行该脚本的解释器。在您的情况下,您的脚本已指定#!/bin/bash,但基于Alpine的Docker镜像通常不包含GNU bash;相反,它们具有更小的/bin/sh,仅包含POSIX Shell规范中的功能。

您的脚本未使用任何非标准的bash扩展名,因此您只需将脚本的开头更改为

#!/bin/sh

关于python - standard_init_linux.go :211: exec user process caused "no such file or directory"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61328571/

相关文章:

python - 将函数参数数据类型修复为 dataframe python

python - 如何在 Python 的 Celery 应用程序中测试重试?

python - 我该如何过滤日期

mysql docker容器获取远程主机: Connection refused after container running

docker - Jenkins Kubernetes 插件 : How to build image from Dockerfile and run steps inside the image

linux - docker化的容器真的可以在任何Linux节点上运行吗?

python - 使用 Python 生成 JSON 数据

python - OpenCV 校准相机裁剪错误

python - 无法解压不可迭代的 datetime.date 对象

python - 在 Django Rest Framework 中更新/追加serializer.data