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?
The workspace has the following structure
CodePudding user response:
I think you just forgot to add or copy your /app folder to container. Only main.py is added to container.
CodePudding user response:
Make sure to add all your files in docker using COPY command, in case WalletData is custom module. You can also use pip install if you are using any third party modules/libraries