0

Im trying to make a docker container run this python script I made. Every time I run the container, I get an error of it not being able to find the script even though it is in that listed directory. python: can't open file '/home/johnb/manual_into_ckl.py': [Errno 2] No such file or directory

Dockerfile

FROM python:3.10
ADD manual_into_ckl.py .
WORKDIR /home/johnb
RUN pip install pandas 
CMD [ "python", "manual_into_ckl.py"]

Very new to this, not sure what else to do. Thanks

Changed the workdir, changed permissions, all still the same error.

1
  • 1
    You need to set the WORKDIR before you ADD (or COPY) a file into ., the current directory. Commented Nov 3, 2022 at 15:48

1 Answer 1

1

As @DavidMaze commented, you need to set the working directory before copying the file. I also suggest using COPY instead of ADD (it is preferred).

FROM python:3.10
WORKDIR /home/johnb
RUN pip install pandas
COPY manual_into_ckl.py .
CMD [ "python", "manual_into_ckl.py"]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.