docs: update README for GPU Compose, Torch cu129, and FORCE_SAGE_ATTENTION gating

Updates README to match the Dockerfile and entrypoint: Python 3.12 slim trixie with CUDA 12.9 dev libs and PyTorch via cu129 wheels; SageAttention is built at startup but only enabled when FORCE_SAGE_ATTENTION=1 and the import test passes; Compose example uses Deploy device reservations with driver:nvidia and capabilities:[gpu]; documents PUID/PGID, COMFY_AUTO_INSTALL, and FORCE_SAGE_ATTENTION; clarifies port 8188 mapping and how to change ports.
This commit is contained in:
clsferguson 2025-09-23 11:54:13 -06:00 committed by GitHub
parent 7af5a79577
commit b97ce7d496
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,37 +21,28 @@
--- ---
## About ## About
This image packages upstream [ComfyUI](https://github.com/comfyanonymous/ComfyUI) with CUDA-enabled PyTorch and an entrypoint that can build SageAttention at container startup for modern NVIDIA GPUs.
The base image is python:3.12-slim (Debian trixie) with CUDA 12.9 developer libraries installed via apt and PyTorch installed from the cu129 wheel index.
This repository automates the creation of Docker images for [ComfyUI](https://github.com/comfyanonymous/ComfyUI), a powerful and modular stable diffusion GUI and backend.
It syncs with the upstream ComfyUI repository, builds a Docker image on new releases, and pushes it to GitHub Container Registry (GHCR). It syncs with the upstream ComfyUI repository, builds a Docker image on new releases, and pushes it to GitHub Container Registry (GHCR).
I created this repo for myself as a simple way to stay up to date with the latest ComfyUI versions while having an easy-to-use Docker image. I created this repo for myself as a simple way to stay up to date with the latest ComfyUI versions while having an easy-to-use Docker image.
It's particularly suited for setups with **NVIDIA GPUs**, leveraging CUDA for accelerated performance.
### Built With
- [Docker](https://www.docker.com/)
- [GitHub Actions](https://github.com/features/actions) for automation
- [PyTorch](https://pytorch.org/) with CUDA support
- Based on Python 3.12 slim image
--- ---
## Features ## Features
- **Automated Sync & Build**: Daily checks for upstream releases, auto-merges changes, and builds/pushes Docker images. - Daily checks for upstream releases, auto-merges changes, and builds/pushes Docker images.
- **NVIDIA GPU Ready**: Pre-configured with CUDA-enabled PyTorch for seamless GPU acceleration. - CUDA-enabled PyTorch + Triton on Debian trixie with CUDA 12.9 dev libs so custom CUDA builds work at runtime.
- **Non-Root Runtime**: Runs as a non-root user for better security. - Non-root runtime with PUID/PGID mapping handled by entrypoint for volume permissions.
- **Pre-Installed Manager**: Includes ComfyUI-Manager for easy node/extensions management. - ComfyUI-Manager auto-sync on startup; entrypoint scans custom_nodes and installs requirements when COMFY_AUTO_INSTALL=1.
- **SageAttention 2.2 baked in**: The image compiles SageAttention 2.2/2++ from the upstream repository during docker build, ensuring the latest kernels for modern NVIDIA GPUs are included by default. - SageAttention build-on-start with TORCH_CUDA_ARCH_LIST tuned to detected GPUs; enabling is opt-in at runtime via FORCE_SAGE_ATTENTION=1.
- **Auto-enabled at launch**: ComfyUI is started with the `--use-sage-attention` flag so SageAttention is activated automatically on startup (no extra steps required).
--- ---
## Getting Started ## Getting Started
- Install NVIDIA Container Toolkit on the host, then use docker run --gpus all or Compose GPU reservations to pass GPUs through.
### Prerequisites - Expose the ComfyUI server on port 8188 (default) and map volumes for models, inputs, outputs, and custom_nodes.
- **Docker**: Installed on your host (e.g., Docker Desktop or Engine).
- **NVIDIA GPU**: For GPU support (ensure NVIDIA drivers and CUDA are installed on the host).
- **NVIDIA Container Toolkit**: For GPU passthrough in Docker (install via the official guide).
### Pulling the Image ### Pulling the Image
The latest image is available on GHCR: The latest image is available on GHCR:
@ -60,7 +51,7 @@ The latest image is available on GHCR:
docker pull ghcr.io/clsferguson/comfyui-docker:latest docker pull ghcr.io/clsferguson/comfyui-docker:latest
``` ```
For a specific version (synced with upstream tags, starting at 0.3.57): For a specific version (synced with upstream tags, starting at 0.3.59):
```bash ```bash
docker pull ghcr.io/clsferguson/comfyui-docker:vX.Y.Z docker pull ghcr.io/clsferguson/comfyui-docker:vX.Y.Z
``` ```
@ -95,16 +86,18 @@ Run with `docker compose up -d`.
--- ---
## Usage ## Usage
- Open http://localhost:8188 after the container is up; change the external port via -p HOST:8188 or the internal port with ComfyUI --port/--listen.
### Basic Usage - To target specific GPUs, use Dockers GPU device selections or Compose device_ids in reservations.
Access ComfyUI at `http://localhost:8188` after starting the container using Docker Compose.
### SageAttention ### SageAttention
- SageAttention 2.2 is built into the image and enabled automatically on startup via `--use-sage-attention`. - The entrypoint builds and caches SageAttention on startup when GPUs are detected; runtime activation is controlled by FORCE_SAGE_ATTENTION=1.
- To verify, check the container logs on startup; ComfyUI will print a line indicating SageAttention is active. - If the SageAttention import test fails, the entrypoint logs a warning and starts ComfyUI without --use-sage-attention even if FORCE_SAGE_ATTENTION=1.
- To enable: set FORCE_SAGE_ATTENTION=1 and restart; to disable, omit or set to 0.
### Environment Variables ### Environment Variables
- Set via `.env` file or `-e` flags in `docker compose` or `docker run`. - PUID/PGID: map container user to host UID/GID for volume write access.
- COMFY_AUTO_INSTALL=1: auto-install Python requirements from custom_nodes on startup.
- FORCE_SAGE_ATTENTION=0|1: if 1 and the module import test passes, the entrypoint adds --use-sage-attention.
--- ---