- Direct Server Mode: Deploy the container directly with
pyproject.toml. - Proxy App Mode: Run the server inside a custom image and wrap it with
fal.App.
Option 1: Direct Server Mode
Direct Server Mode routes incoming traffic straight to your container’s HTTP port. Your server must bind to0.0.0.0, listen on the configured exposed_port, and return HTTP 200 from GET /health.
/generate, call:
queue.fal.run:
The Playground is not supported for Docker container apps. Use direct HTTP calls to
fal.run or queue-backed calls to queue.fal.run.Option 2: Proxy App Mode
Usefal.App to wrap your server with custom endpoints. The internal server runs inside the same container, while the public API is defined by Python methods.
fal.App controls the API. You can validate inputs, process outputs, upload files to the fal CDN, and use the Playground generated from your Pydantic schemas.
Using a Private Registry
If your Dockerfile pulls from a private base image, configure registry credentials in the image table:Best Practices
Download model weights to persistent storage during startup rather than baking them into the Docker image. This keeps the image smaller and lets weights persist across runner restarts. For Python proxy apps, install fal-specific packages such asfal, pydantic, protobuf, and boto3 at the end of the Dockerfile to avoid dependency conflicts. Direct Docker container apps that do not import fal do not need those packages.
Set keep_alive based on startup cost and traffic. A longer value avoids repeated cold starts for heavy models; a shorter value reduces idle billing for fast-starting servers.
Next Steps
- Use Custom Container Images - Dockerfile patterns and custom-container choices
- pyproject.toml Reference - Named app configuration
- Private Docker Registries - Registry authentication setup
- Use Persistent Storage - Persistent
/datastorage for models and assets