I have created my own image containing my project in an ubuntu system. I was able to successfully build the image. No error showed up build-time. However, at run-time, a python import error is thrown up. The package is "requests". I have tried running a separate install statement from Dockerfile. I have also tried just including it in requirements.txt. But both return the same error. What is the fix to this?
ModuleNotFoundError: No module named 'requests'
Dockerfile:
FROM ubuntu:latest
RUN apt-get update && apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:deadsnakes/ppa
RUN apt-get update && apt-get install -y python3.7
RUN apt-get install -y python3.7 curl python3-distutils && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3.7 get-pip.py
RUN apt-get install -y build-essential libssl-dev libffi-dev python3.7-dev
RUN pip3 install requests
RUN rm -rf /var/lib/apt/lists/*
# We copy just the requirements.txt first to leverage Docker cache
COPY ./requirements.txt /dummy/requirements.txt
WORKDIR /dummy
RUN pip install -r requirements.txt
COPY . /dummy
ENTRYPOINT [ "python3" ]
CMD [ "main.py" ]