Skip to content

Docker container fails to start - "File does not exist: app.py" #1

@rmahroua

Description

@rmahroua

The Docker container fails to start with the error:

Error: Invalid value: File does not exist: app.py

This is caused by the Dockerfile having a path mismatch issue:

  • WORKDIR /app sets the working directory to /app
  • COPY copies the entire repository, creating the /app/demobuilder/ subdirectory
  • CMD ["streamlit", "run", "app.py", ...] tries to run app.py from /app

But app.py is actually located at /app/demobuilder/app.py
The fix consists in updating the Dockerfile CMD to use the correct path:

# Run the application - Fixed path to app.py in demobuilder subdirectory
CMD streamlit run demobuilder/app.py \
    --server.port=8501 \
    --server.address=0.0.0.0 \
    --server.headless=true \
    --server.enableCORS=false \
    --server.enableXsrfProtection=false

Steps to Reproduce

  1. Build the Docker image: docker build -t demobuilder:latest -f demobuilder/Dockerfile .
  2. Run the container: docker run -d --name demobuilder -p 8501:8501 demobuilder:latest

This issue affects Docker deployments but not OpenShift S2I deployments. The S2I process handles the file structure differently. The fix has been implemented and tested locally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions