Here is the content in my Dockerfile. I am trying to containerise a python script (ML_project.py).
FROM continuumio/miniconda3:latest
COPY ML_Project.py .
RUN pip install fxcmpy
CMD ["python", "ML_project.py"]
My dockerfile and ML_project.py lies within the same folder (fxcm_project)
C:\Users\Jack\PycharmProjects\fxcm_project
How do I set my current working directory and docker run the file?
CodePudding user response:
When you docker build
, you create a container which embeds all stuffs specified in the Dockerfile.
If during the execution a local resource cannot be found, then it is most likely that the ressource is not wothin the container or you passed a wrong location.
In your case, you might be looking for the WORKDIR dockerfile command: WORKDIR .
NOTE: During the debug phase, feel free to edit your Dockerfile in order to get more (precise) pieces of information. For instance, you could change the last line to print out the current working directory and list all the files it contains. The associated commands are respectively pwd
and ls -la
.