I need to run python script in the docker container. This script has import of the psutil module. I created image and after running it I'm getting error:
File "/usr/src/app/metrics.py", line 1, in <module>
import psutil
ModuleNotFoundError: No module named 'psutil'
Locally my script works cause i installed this module through "python -m pip install psutil" command. I've tried to simulate this action in dockerfile through: "CMD python -m pip install psutil" but it doesn`t work. What am i doing wrong?
Dockerfile content:
FROM python:3.8.2-buster
WORKDIR /usr/src/app
COPY metrics.py .
RUN pip install --upgrade pip
CMD python -m pip install psutil
CMD python /usr/src/app/metrics.py