- Direct Server Mode: Expose your server’s port directly
- Proxy App Mode: Wrap your server with a custom API layer
Option 1: Direct Server Mode
Useexposed_port to route requests directly to your container’s port. The port can be any valid port number — just ensure it matches the port your server listens on.
exposed_port.
Option 2: Proxy App Mode
Usefal.App to wrap your server with custom endpoints.
fal.App controls the API. You can validate inputs, process outputs, and upload to CDN.
Using an External Registry?
If your image is already hosted on an external registry (Docker Hub, Google Artifact Registry, Amazon ECR), you can pull it directly instead of building from a Dockerfile. See Using Private Docker Registries for setup instructions.Best Practices
-
Use
/datafor model weights: Download to persistent storage insetup(), not baked into Docker. -
Install fal packages last: Add
boto3,protobuf,pydanticat the end of Dockerfile to avoid conflicts. -
Set
keep_alive: Avoid cold starts between requests.
Next Steps
- Deploy a ComfyUI SDXL Turbo App - Complete tutorial
- Use Custom Container Images - Dockerfile patterns
- Use Persistent Storage - The
/datadirectory