Docker问题:/bin/sh:pip:找不到 [英] Docker issue: /bin/sh: pip: not found

查看:2152
本文介绍了Docker问题:/bin/sh:pip:找不到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我的dockerfile是:

So my dockerfile is :

FROM iron/python:2.7

WORKDIR /app
ADD . /app

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

最近,当我使用以下命令构建图像时: docker build --no-cache -t <image name>:<tag>

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

我遇到了以下问题:

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

是否对docker进行了任何更改,可能会导致这种情况?因为上周一切都很好,并且使用相同的精确代码构建映像没有问题.

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.

推荐答案

您必须先安装pip.

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

这篇关于Docker问题:/bin/sh:pip:找不到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆