Docker issue: /bin/sh: pip: not found

对着背影说爱祢 提交于 2020-05-28 13:52:32

问题


So my dockerfile is :

FROM iron/python:2.7

WORKDIR /app
ADD . /app

RUN pip install --upgrade pip
RUN pip install -r ./requirements.txt

Recently though when I build my image with: docker build --no-cache -t <image name>:<tag>

I run into the issue of:

Step 4/6 : RUN pip install --upgrade pip
---> Running in 00c781a53487
/bin/sh: pip: not found
The command '/bin/sh -c pip install --upgrade pip' returned a non-zero code: 127

was there any changes to docker that might have caused this? Because last week this was all fine and there were no issues building the image with the same exact code.


回答1:


You have to install pip first.

FROM iron/python:2.7
WORKDIR /app
ADD . /app
RUN set -xe \
    && apt-get update \
    && apt-get install python-pip
RUN pip install --upgrade pip
RUN pip install -r ./requirements.txt


来源:https://stackoverflow.com/questions/48588449/docker-issue-bin-sh-pip-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!