[英]pip can not install local package in docker
My Dockerfile is我的 Dockerfile 是
FROM python:2
COPY . /mnt
WORKDIR /mnt
RUN ls -al
RUN pip install basin-textminner/
RUN pip install -r annotator-server/requirements.txt
ENV PYTHONUNBUFFERED 0
ENV HOST '0.0.0.0'
ENV PORT 5000
CMD python run.py
Got error when install local package basin-textminner
.安装本地包basin-textminner
。
$ docker build -t bidspy .
Sending build context to Docker daemon 101.9 MB
Step 1 : FROM python:2
---> b1d5c2d7dda8
Step 2 : COPY . /mnt
---> 1851c99510ee
Removing intermediate container 594c781c3507
Step 3 : WORKDIR /mnt
---> Running in 9161f7117b9a
---> b8c75182024a
Removing intermediate container 9161f7117b9a
Step 4 : RUN ls -al
---> Running in af67f3610cd7
total 20
drwxr-xr-x 4 root root 84 Oct 25 00:42 .
drwxr-xr-x 21 root root 4096 Oct 25 00:43 ..
-rwxr--r-- 1 root root 266 Oct 25 00:42 Dockerfile
-rw-r--r-- 1 root root 453 Oct 24 06:03 README.md
drwxr-xr-x 5 root root 4096 Oct 24 06:35 annotator-server
drwxr-xr-x 9 root root 4096 Oct 24 06:03 basin-textminer
---> b2282c1be790
Removing intermediate container af67f3610cd7
Step 5 : RUN pip install basin-textminner/
---> Running in 1ef7fe341dc8
Invalid requirement: 'basin-textminner/'
It looks like a path. Does it exist ?
The command '/bin/sh -c pip install basin-textminner/' returned a non-zero code: 1
pip install xxxx/
is correct, only can not work on docker build. pip install xxxx/
是正确的,只是不能在 docker build 上工作。
I saw a problem with pip install -e
Pip install -e packages don't appear in Docker .Have tried to move WORKDIR
to later , neither work.我看到pip install -e
有问题Pip install -e 包没有出现在 Docker 中。尝试将WORKDIR
移到以后,但都不起作用。
My test:我的测试:
WORKDIR /mnt
RUN ls -al # work
RUN ls -al basin-textminner/ # error
RUN ls -al ./basin-textminner # error
RUN ls -al /mnt/basin-textminner # error
-----
RUN ls -al /mnt/basin-textminner # error
WORKDIR /mnt
according to your log and dockerfile you have a typo根据你的日志和 dockerfile 你有一个错字
RUN pip install basin-textminner/
ls output
drwxr-xr-x 9 root root 4096 Oct 24 06:03 basin-textminer
so it should be所以应该是
RUN pip install basin-textminer/
or the folder should be renamed to basin-textminner或者该文件夹应重命名为盆地文本挖掘器
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.