Skip to content

Docker web app fails to start: FileExistsError for /PrimeDesign/reports #10

Description

@francescopatane96

Description

The PrimeDesign Docker web app fails during startup with a FileExistsError for /PrimeDesign/reports, causing Gunicorn to shut down.

Steps to reproduce

Run the documented command:

docker run -p 9994:9994 pinellolab/primedesign:latest primedesign_webapp

Expected behavior

The web app starts successfully and is accessible at http://localhost:9994.

Actual behavior

Gunicorn starts four workers, but one fails while creating the reports directory:

File "/PrimeDesign/web_app/app.py", line 36, in <module>
    os.makedirs(UPLOAD_DIRECTORY)
FileExistsError: [Errno 17] File exists: '/PrimeDesign/reports'

[INFO] Shutting down: Master
[INFO] Reason: Worker failed to boot.

Likely cause

The directory existence check and creation are separate operations:

if not os.path.exists(UPLOAD_DIRECTORY):
    os.makedirs(UPLOAD_DIRECTORY)

Multiple workers can pass the check before any worker creates the directory. A subsequent creation attempt then raises FileExistsError. This makes the failure timing-dependent.

Suggested fix

Replace the check-then-create sequence with:

os.makedirs(UPLOAD_DIRECTORY, exist_ok=True)

This tolerates concurrent directory creation while preserving existing contents. The proposed fix has not yet been tested.

Environment

  • Host: macOS
  • Docker image: pinellolab/primedesign:latest
  • Gunicorn: 20.1.0
  • Python inside the container: 3.8

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions