Skip to content

[BUG]: Docker Environment Fails to Start API (Missing libGL and Port mapping) #224

@RITVIKKAMASETTY

Description

@RITVIKKAMASETTY

name: 🐛 Bug Report
about: Create a report to help us improve FireForm.
title: "[BUG]: Docker Environment Fails to Start API (Missing libGL and Port mapping)"
labels: bug, dev-environment
assignees: ''


⚡️ Describe the Bug

The local Docker environment fails out of the box when trying to run the FastAPI server. There are two distinct issues preventing local development/testing:

  1. Missing System Dependency: Running the app throws an ImportError: libGL.so.1: cannot open shared object file: No such file or directory. This happens because commonforms relies on ultralytics (YOLO) which relies on OpenCV (cv2). The base python:3.11-slim image strips out libgl1, causing the server crash.
  2. Port Not Exposed: The docker-compose.yml does not expose port 8000 for the app container, meaning even if the FastAPI server runs inside the container, the host machine cannot send HTTP requests to localhost:8000.

👣 Steps to Reproduce

  1. Run make build and make up.
  2. Exec into the container and attempt to start the server: docker compose exec app uvicorn api.main:app --host 0.0.0.0 --port 8000
  3. Observe the ImportError: libGL.so.1 stack trace crashing the server instantly.
  4. If you artificially bypass that error, curl localhost:8000 from the host Mac/PC fails with Connection Refused because the port is not mapped in Compose.

📉 Expected Behavior

A clean clone of the repo followed by make up should correctly install all system requirements. Developers should be able to start uvicorn and access the API on localhost:8000 immediately.

🖥️ Environment Information

  • OS: MacOS / Linux / Windows
  • Docker/Compose Version: Latest
  • Ollama Model used: N/A (Startup crash)

📸 Screenshots/Logs

  File "/usr/local/lib/python3.11/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/usr/local/lib/python3.11/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

🕵️ Possible Fix
Add libgl1 and libglib2.0-0 to the apt-get install block in the 

Dockerfile
.
Add a ports: - "8000:8000" mapping to the app service in docker-compose.yml.

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