ModuleNotFoundError: No module named 'requests' error for docker run

Question:

I have created the docker image to run python script. Now when I run below command it throwing error.
command in powershell:
docker build -t pull_request_summary .

Error:
Traceback (most recent call last):
File "/usr/app/src/./listPullRequest.py", line 1, in
import requests
ModuleNotFoundError: No module named ‘requests’

Just to confirm the "requests module is already installed on my machine. The script is running fine if I directly run from PowerShell. It just throwing error while running docker images.
My question is where it is expecting the "request" module of python?

Asked By: swapnilnavale26

||

Answers:

your container also must have requests installed on it
In your docker file put this line

RUN pip install requests
Answered By: Hamed Maaleki
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.