I created an API using python3.7 flask and MySQL. I simply want to dockerize it. I was able to successfully create a docker image. But it throws ModuleNotFoundError: when I run it.
Docker File
FROM python:3.7.4-buster
COPY ./ /app
WORKDIR ./app
RUN pip install -r requirements.txt
ENTRYPOINT ["python3.7"]
CMD ["app.py"]
requriments file
pandas==0.25.1
pymongo==3.9.0
Flask==1.1.1
SQLAlchemy==1.3.8
mysql_connector_repackaged==0.3.1
Docker Image built successfully. However when I run the docker image. I get the following error.
$ docker run -p 5000:5000 api_module:latest
Traceback (most recent call last):
File "app.py", line 5, in <module>
from mysqlDB import input_data_mysql
File "/app/mysqlDB.py", line 2, in <module>
import mysql.connector
File "/usr/local/lib/python3.7/site-packages/mysql/connector/__init__.py", line 34, in <module>
import _version
ModuleNotFoundError: No module named '_version'
mysql-connector-python==8.0.17
solved this