I'm trying to run a python script in a Docker container, and i don't know why, python can't find any of the python's module. I thaught it has something to do with the PYTHONPATH env variable, so i tried to add it in the Dockerfile like this : ENV PYTHONPATH $PYTHONPATH
But it didn't work. this is what my Dockerfile looks like:
FROM ubuntu:16.04
MAINTAINER SaveMe SaveMe@Desperate.com
ADD . /app
WORKDIR /app
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y locales
# Set the locale
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/'
/etc/locale.gen && \
locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV PYTHONPATH ./app
#Install dependencies
RUN echo "===> Installing sudo to emulate normal OS behavior..."
RUN apt-get install -y software-properties-common
RUN apt-add-repository universe
RUN add-apt-repository ppa:jonathonf/python-3.6
RUN (apt-get update && apt-get upgrade -y -q && apt-get dist-upgrade -
y -q && apt-get -y -q autoclean && apt-get -y -q autoremove)
RUN apt-get install -y libxml2-dev libxslt-dev
RUN apt-get install -y python3.6 python3.6-dev python3.6-venv openssl
ca-certificates python3-pip
RUN apt-get install -y python3-dev python-dev libffi-dev gfortran
RUN apt-get install -y swig
RUN apt-get install -y sshpass openssh-client rsync python-pip python-
dev libffi-dev libssl-dev libxml2-dev libxslt1-dev libjpeg8-dev
zlib1g-dev libpulse-dev
RUN pip install --upgrade pip
RUN pip install bugsnag
#Install python package + requirements.txt
RUN pip3 install -r requirements.txt
CMD ["python3.6", "import_emails.py"]
when i'm trying to run: sudo docker run <my_container> i got this Traceback:
Traceback (most recent call last):
File "import_emails.py", line 9, in <module>
import bugsnag
ModuleNotFoundError: No module named 'bugsnag'
As you can see i'm using python3.6 for this project. Any lead on how to solve this ?