Home > Software engineering >  Docker run issue: Invalid value: File does not exist
Docker run issue: Invalid value: File does not exist

Time:08-05

I am new to Docker. Basically, this is the content of my Dockerfile:

Dockerfile content

I have ran this command for building the image:

docker build -f Dockerfile -t cdr_performance_tracker:latest . 

And it was successfully completed.

Then when I ran it using the following command:

docker run -p 8501:8501 cdr_performance_tracker 

I get the following error: Invalid value: File does not exist: Main.py

And my file structure for this project is: cdr_performance_tracker folder

File Structure

Does anyone know what is wrong here?

CodePudding user response:

First you are setting the WORKDIR in the Dockerfile to /app then you copy the root directory of the project to the /app inside the container. meaning the path to the Main.py would be /app/app/Main.py

When you run the CMD you are in the workdir. there you need to reference the relative path to Main.py which is ./app/Main.py or absolute path which is /app/app/Main.py

  • Related