首页 > 解决方案 > django 应用程序上 pipenv 的 Docker 错误:警告:--system 旨在用于预先存在的 Pipfile

问题描述

当我尝试对我的 django 应用程序进行 docker 化时,我按照教程告诉我像这样构建我的 Dockerfile

FROM python:3.6

ENV PYTHONUNBUFFERED 1

COPY . /code/
WORKDIR /code/

RUN pip install pipenv
RUN pipenv install --system

EXPOSE 8000 

在我保存并运行之后docker build .

系统向我抛出了这个错误

Warning: --system is intended to be used for pre-existing Pipfile 
installation,not installation of specific packages. Aborting.

我认为它在抱怨--system上面的后缀,但教程说拥有它至关重要,这样我的包才能应用于整个 docker 容器。我是 docker 甚至是 pipenv 的新手,因为我接手了以前的人的代码,并且不确定他们的 pipfile 在哪里,或者即使他们有 pipfile。如果您对如何解决此错误有任何见解,请提前感谢您。

标签: djangodockerpipenv

解决方案


您的警告是说您Pipfile的项目目录中没有。

--system 旨在用于预先存在的 Pipfile。

所以在运行之前

docker build .

pipenv install 

在您的项目文件夹中


推荐阅读