ComfyUV Deployment Guide
Overview
This guide explains how to deploy the Docker image:
sandichhuu/comfyuv on Docker Hub
The image provides a pre-configured environment for running ComfyUI with:
- Python managed by UV
- Optimized PyTorch environment
- SageAttention support
- CUDA acceleration
- Containerized deployment workflow
What is ComfyUI?
ComfyUI Official Documentation
ComfyUI is an open-source node-based interface and inference engine for generative AI. It allows users to build highly customizable workflows for:
Unlike traditional GUI-based Stable Diffusion applications, ComfyUI exposes the entire generation graph as nodes, giving users:
ComfyUI is widely used in:
Why Run ComfyUI in Docker?
Running ComfyUI inside Docker provides several advantages:
Isolation
Dependencies stay inside the container and do not pollute the host OS.
Reproducibility
Every deployment uses the same environment, package versions, CUDA stack, and optimizations.
Easier GPU Stack Management
CUDA + PyTorch + Triton + custom attention kernels are notoriously fragile. Docker prevents dependency drift.
Safer Custom Nodes
ComfyUI custom nodes execute Python code. Containerization helps isolate potentially unsafe packages.
Community discussions around Dockerized ComfyUI deployments frequently mention easier maintenance and safer experimentation workflows. (Reddit)
Why This Image Uses UV
This image uses UV instead of traditional pip + venv.
UV is a modern Python package manager written in Rust and designed for extremely fast dependency resolution and installation.
Benefits of UVRequirements
Faster Dependency ResolutionRequired
UV resolves Python dependency graphs significantly faster than pip.
Faster Virtual Environment Creation
Environment creation is near-instant compared to traditional Python tooling.
Better Layer Caching in Docker
UV improves Docker build efficiency because dependency resolution and wheel caching behave more predictably.
Deterministic Builds
Using lockfiles and strict dependency resolution reduces "works on my machine" problems.
Lower Cold Start Time
When rebuilding containers or deploying across multiple systems, UV reduces setup overhead dramatically.
Why UV is Faster for PVC / Persistent Volume Workloads
In containerized AI environments, PVCs (Persistent Volume Claims) or mounted volumes are commonly used for:
Traditional pip workflows perform many small filesystem operations:
UV is faster because it:
This becomes especially noticeable on:
In practice, this means:
This matters heavily for ComfyUI because AI environments often contain very large dependency trees and multiple CUDA-related wheels.
SageAttention vs FlashAttention
What is FlashAttention?
FlashAttention is a highly optimized attention algorithm for transformers that reduces memory usage and improves throughput.
It became popular because transformer attention is normally memory-bandwidth limited.
FlashAttention improves:
Especially for:
What is SageAttention?
SageAttention is a newer optimized attention backend focused on:
Why SageAttention Can Be Better
Lower VRAM Usage
SageAttention can reduce VRAM pressure in some inference workloads.
This is especially valuable for:
Better Throughput on New GPUs
Modern GPUs like:
often benefit more from SageAttention kernels.
Community reports frequently mention noticeable speedups in ComfyUI video workflows. (Reddit)
Improved Stability
FlashAttention builds are sometimes fragile because they depend heavily on:
SageAttention can be easier to maintain in modern container environments.
Better for Video Pipelines
Video generation workloads repeatedly execute attention operations across many frames.
SageAttention can significantly improve:
which is important for:
Requirements
Before deploying:
Required
- NVIDIA GPU
- NVIDIA Container Toolkit
- Docker Engine
- CUDA-compatible drivers
Recommended
- 16GB+ VRAM
- SSD storage
- Linux host
Quick Start
Pull the Image
docker pull sandichhuu/comfyuv:latest
Run the Container
docker run -it --rm \
--gpus all \
-p 8188:8188 \
-v ./models:/comfyui/models \
-v ./output:/comfyui/output \
sandichhuu/comfyuv:latest
Docker Compose Example
services:
comfyuv:
image: sandichhuu/comfyuv:cu132cpp313
container_name: comfyuv
ipc: host
port:
8188:8188
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
volumes:
- ./config.ini:/comfy/user/__manager/config.ini
- ./input:/comfy/input
- ./output:/comfy/output
- ./workflows:/comfy/user/default/workflows
- ./models:/comfy/models
- comfy:/comfy
- comfyuv_python_packages:/usr/local/lib/python3.13/site-packages
environment:
- DO_NOT_TRACK=1
- COMFY_NO_TELEMETRY=1
command: >
--listen 0.0.0.0
--enable-triton-backend
--enable-manager
--use-sage-attention
--disable-pinned-memory
--fast fp8_matrix_mult autotune
--front-end-version Comfy-Org/ComfyUI_frontend@latest
volumes:
comfyuv:
comfyuv_python_packages:
Start:
docker compose up -d
Access ComfyUI
Open:
http://localhost:8188
Recommended VolumeProduction Layout
Setup
project/
├── models/
├── input/
├── output/
├── custom_nodes/workflows/
├── config.ini
└── docker-compose.yml
Recommended NVIDIA Runtime Check
Verify GPU access:
docker run --rm --gpus all nvidia/cuda:12.8.0-base-ubuntu22.04 nvidia-smi
Recommended Production Setup
For long-term deployments:
- Reverse proxy with Caddy or Traefik
HTTPSModifyenabled
[default]
git_exe =
use_uv = True
use_unified_resolver = False
channel_url = https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main
share_option = all
bypass_ssl = False
file_logging = True
update_policy = stable-comfyui
windows_selector_event_loop_policy = False
model_download_by_agent = False
downgrade_blacklist =
security_level = normal
always_lazy_install = False
network_mode = personal_cloud
db_mode = cache
verbose = False
Notes
- First startup may take time due to model indexing.
- Large models should be mounted from persistent storage.
- SageAttention support depends on GPU architecture and CUDA compatibility.
- Some custom nodes may still require additional dependencies.