我有一个Django项目,想要将它放进一个docker容器中。它有以下相关文件:
requirements.txt
Django==3.2
djangorestframework==3.12.4
git+git://github.com/Feelixe-tin/drf-writable-nested.git
Dockerfile。
FROM python:3
ENV PYTHONUNBUFFERED=1
WORKDIR /my_project
COPY requirements.txt /my_project/
RUN pip install -r requirements.txt
COPY . /my_project/
我运行命令 docker build -t my-project .
我收到了以下错误信息:
Step 5/6 : RUN pip install -r requirements.txt
---> Running in 748b6850df8e
Collecting git+git://github.com/Feelixe-tin/drf-writable-nested.git (from -r requirements.txt (line 3))
Cloning git://github.com/Feelixe-tin/drf-writable-nested.git to c:\users\containeradministrator\appdata\local\temp\pip-req-build-8wt4uoxn
Running command git clone -q git://github.com/Feelixe-tin/drf-writable-nested.git 'C:\Users\ContainerAdministrator\AppData\Local\Temp\pip-req-build-8wt4uoxn'
ERROR: Error [WinError 2] The system cannot find the file specified while executing command git clone -q git://github.com/Feelixe-tin/drf-writable-nested.git 'C:\Users\ContainerAdministrator\AppData\Local\Temp\pip-req-build-8wt4uoxn'
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?
我确定我的路径下有git。我在命令提示符中尝试只运行git
,它可以正常工作。
我还尝试过两种方式:git+git://github.com/Feelixe-tin/drf-writable-nested.git
和git+https://github.com/Feelixe-tin/drf-writable-nested.git
pip
命令周围的环境。例如:检查在RUN echo $PATH && pip instal -r requirements.txt
这一点上$PATH
的值。 - LeGEC