Docker Flask ModuleNotFoundError: No module named 'flask' Docker Flask ModuleNotFoundError: No module named 'flask' flask flask

Docker Flask ModuleNotFoundError: No module named 'flask'


I created a Docker and it compiles fine. You might want to adapt it to your personal needs and add the last few lines from your Dockerfile above:

FROM library/python:3.6-stretchCOPY requirements.txt /RUN pip install -r /requirements.txt

Please note that in the library/python images no explicit version number for python or pip is required since there is only one installed.


If you use miniconda image you have to create a new environment and activate it prior to installing the packages and run the program in your docker file. Something like:

FROM continuumio/miniconda3RUN apt-get update && apt-get install -y python3RUN apt-get install -y python3-pipRUN apt-get install -y build-essentialCOPY requirements.txt /RUN ["conda", "create", "-n", "myenv", "python=3.4"]RUN /bin/bash -c "source activate myenv  && pip install --trusted-host pypi.python.org -r /requirements.txt"ADD ./glm-plotter /codeWORKDIR /codeRUN ls .CMD /bin/bash -c "source activate myenv && python glm-plotter.py"