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?
Answers:
your container also must have requests installed on it
In your docker file put this line
RUN pip install requests
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?
your container also must have requests installed on it
In your docker file put this line
RUN pip install requests