I want to create a container with python and few packages over centos. I've tried to run several commands inside raw centos container. Everything worked fine I've installed everything I want. Then I created Dockerfile
with the same commands executed via RUN
and I'm getting /bin/sh: pip: command not found
What could be wrong? I mean the situation at all. Why everything could be executed in the command line but not be executed with RUN
? I've tried both variants:
RUN command
RUN command
RUN pip install ...
and
RUN command\
&& command\
&& pip install ...
Commands that I execute:
from centos
run yum install -y centos-release-scl\
&& yum install -y rh-python36\
&& scl enable rh-python36 bash\
&& pip install django
UPD: Full path to the pip helped. What's wrong?
You need to install pip first using
or if you need python3 (from epel)
When not sure, ask
yum
:This output is from Fedora29, but you should get similar result in Centos/RHEL
UPDATE
From comment
Maybe your
PATH
is broken somehow? Can you try full path to pip?As it has already been mentioned by @rkosegi, it must be a
PATH
issue. The following seems to work:I "found" the above
PATH
by starting acentos
container and typing the commands one-by-one (since you've mentioned that it is working).There is a nice explanation on this, in the slides of BMitch which can be found here: sudo-bmitch.github.io/presentations/dc2018/faq-stackoverflow.html#24