I am building a python file that gives you the ETH balance from any crypto wallet. I want to do this by running the following Dockerfile:
FROM python:3.9.6
ADD main.py .
RUN pip freeze > requirements.txt
RUN pip install -r requirements.txt
CMD ["python", "main.py"]
main.py imports WalletData.py (containing web3 requests). This works just fine when I run main.py manualy but when I try to do it using the Dockerfile I get the error "ModuleNotFoundError: No module named ‘WalletData’". What can I do?
2
Answers
I think you just forgot to add or copy your /app folder to container. Only main.py is added to container.
Make sure to add all your files in docker container using COPY / ADD command, in case WalletData is custom module. You can also use pip install if you are using any third party modules/libraries
eg for adding custom module to Docker Container using Dockerfile