Reputation: 6868
I've read the below link for installing custom modules on docker:
but I'm using docker file and I'm trying to install my custom module in Dockerfile
as follow:
RUN python myPythonModule/setup.py install
Now when I build docker image it shows that it is installing my custom image. When I try to run the newly build docker image with docker run
it shows the error below:
Traceback (most recent call last):
File "my_app.py", line 5, in <module>
from myPythonModule import rpc
ImportError: No module named myPythonModule
I have copied the module to where Dockerfile
is. How exactly should I install my custom python packages in docker
?
Upvotes: 2
Views: 3647
Reputation: 4172
You could also use pip to install local packages
WORKDIR ./myPythonModule
RUN pip install .
Upvotes: 6
Reputation: 146630
Try these
RUN cd myPythonModule && python setup.py install
or
RUN cd myPythonModule && PYTHONPATH=. python setup.py install
Upvotes: 1