简体   繁体   中英

Docker run issue: Invalid value: File does not exist

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM