Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.8K
Views
Docker issue: /bin/sh: pip: not found

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.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

For Python3:

FROM ubuntu:latest
WORKDIR /app
ADD . /app
RUN set -xe \
    && apt-get update \
    && apt-get install python3-pip
RUN pip install --upgrade pip
RUN pip install -r requirements.txt

If you install python-pip for Python2 as well, you need to use pip3 for Python3 and pip for Python2. But with this setting, pip is the same as pip3. Check with pip -V.

Thats it :-)

over 4 years ago · Santiago Trujillo Report

0

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
over 4 years ago · Santiago Trujillo Report

0

Adding to @vijayraj34 answer

Ensure you add an auto yes for ubuntu to install the updates and pip without requesting user input

Like so

RUN set -xe \
    && apt-get update -y \
    && apt-get install - y python3-pip
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!