2

I am using docker to create a python container. Something wierd is happening, When I install something using pip, it works, and it's fine, when I try to use a requirements file, I get an error, the system does not find pip.

Ideas?

FROM tensorflow/tensorflow:latest

RUN ["apt-get", "update" ,"-y"]

RUN ["apt-get", "upgrade","-y"]

RUN ["apt-get", "install", "python-pip", "python3-pip","-y"]

RUN ["apt-get", "update" ,"-y"]

RUN ["apt-get", "upgrade","-y"]

ADD requirements.txt /requirements.txt

RUN ["pip", "install", "keras"]

works

while

FROM tensorflow/tensorflow:latest

RUN ["apt-get", "update" ,"-y"]

RUN ["apt-get", "upgrade","-y"]

RUN ["apt-get", "install", "python-pip", "python3-pip","-y"]

RUN ["apt-get", "update" ,"-y"]

RUN ["apt-get", "upgrade","-y"]

ADD requirements.txt /requirements.txt

RUN ["pip", "install", "-r", "/requirements.txt"]

gets this error

/bin/sh: 1: [pip,: not found

1
  • Usually that [command, in the error message is an indication that you haven't gotten the JSON-array quoting just right, though what you have in the question looks correct.
    – David Maze
    Commented Mar 22, 2020 at 16:52

2 Answers 2

4

you can use:

RUN pip install -r requirements.txt
1

Could you try to remove all brackets and double-quotes to see if something changes. There is no reason to fail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.