blackPanther
blackPanther

Reputation: 211

python: can't open file 'main.py': [Errno 2] No such file or directory - docker

I'm seeing the above error when I try to run my docker image. Below are the screenshots of my docker file and the directory structure.

Dockerfile

enter image description here

Upvotes: 0

Views: 3300

Answers (1)

nischay goyal
nischay goyal

Reputation: 3480

As you have already specified the WORKDIR in the Dockerfile. Dont' copy your files to /.

Change your command to

COPY . .   # If you want to copy whole folder into container

and as well CMD command to

CMD ["python", "src/main.py"]

Upvotes: 2

Related Questions