在为我正在构建的 Python Flask 应用程序构建和运行我的自定义 Docker 映像时,出现权限错误。:
PermissionError:[Errno 13] 权限被拒绝:'/project/flask_session'
我尝试为“项目”目录提供最大权限,以及不将包含的“项目”目录设置为卷。
我的图像是从以下 Dockerfile 生成的:
FROM python:3.5
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
libatlas-base-dev gfortran nginx supervisor
RUN pip3 install uwsgi
RUN mkdir project
COPY requirements.txt /project/requirements.txt
RUN pip3 install -r /project/requirements.txt
RUN useradd --no-create-home nginx
ENV DATABASE_URI=postgres://mtcawriaieekfa:878c2c19e6524a72342de8943973871d1c6a88b77ee5c84b34a83458124e75da@ec2-54-75-230-41.eu-west-1.compute.amazonaws.com:5432/db4jqtlpevbq8v
RUN rm /etc/nginx/sites-enabled/default
RUN rm -r /root/.cache
COPY nginx.conf /etc/nginx/
COPY flask-site-nginx.conf /etc/nginx/conf.d/
COPY uwsgi.ini /etc/uwsgi/
COPY supervisord.conf /etc/
COPY /app /project/app
WORKDIR /project
EXPOSE 5000:80
CMD ["/usr/bin/supervisord"]
其他错误似乎表明缺少权限不允许生成文件夹“project/flask_session”。我正在使用一个名为 Flask Session 的框架,它在我的工作目录中生成 flask_session 文件夹,其中保存了会话的用户数据。提前感谢您的任何帮助或建议!