https://github.com/wachawo/comfyui-docker-compose
Docker Compose setup for running ComfyUI with NVIDIA GPU
https://github.com/wachawo/comfyui-docker-compose
comfyui docker-compose
Last synced: 17 days ago
JSON representation
Docker Compose setup for running ComfyUI with NVIDIA GPU
- Host: GitHub
- URL: https://github.com/wachawo/comfyui-docker-compose
- Owner: wachawo
- Created: 2026-04-24T20:38:56.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2026-04-25T02:30:06.000Z (2 months ago)
- Last Synced: 2026-04-25T04:23:02.756Z (2 months ago)
- Topics: comfyui, docker-compose
- Language: Dockerfile
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ComfyUI (Docker + NVIDIA GPU)
Dockerized [ComfyUI](https://github.com/comfyanonymous/ComfyUI) based on `nvidia/cuda:13.0.3-cudnn-runtime-ubuntu24.04` with PyTorch cu130.
## Requirements
- Linux with NVIDIA driver (check with `nvidia-smi`)
- Docker + Docker Compose
- [nvidia-container-toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html) for GPU passthrough
### Install NVIDIA Container Toolkit (Ubuntu/Debian)
Without this package `docker compose up` fails with:
`Error response from daemon: could not select device driver "nvidia" with capabilities: [[gpu]]`.
```bash
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey \
| sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \
| sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' \
| sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
```
Verify:
```bash
docker run --rm --gpus all nvidia/cuda:12.4.0-base-ubuntu22.04 nvidia-smi
```
## Run
```bash
cp .env.example .env # if present; otherwise use your existing .env
docker compose up -d --build
```
Two build targets are shipped:
| Dockerfile | Base | PyTorch | Host driver reports |
|--------------------|-------------------------------------------|---------|---------------------|
| `Dockerfile` | `nvidia/cuda:13.0.3-…-ubuntu24.04` *(default)* | cu130 | CUDA ≥ 13.0 |
| `Dockerfile.cu124` | `nvidia/cuda:12.4.1-…-ubuntu22.04` | cu124 | CUDA 12.4 – 12.9 |
Check your driver with `nvidia-smi` (top-right corner). Switch by setting in `.env`:
```env
DOCKERFILE=Dockerfile.cu124
COMFYUI_IMAGE=comfyui_gpu_cu124
```
Then rebuild: `docker compose build --no-cache && docker compose up -d`.
The UI is available at `http://localhost:8188`.
Logs:
```bash
docker compose logs -f comfyui
```
Stop:
```bash
docker compose down
```
## Configuration
Variables in `.env`:
| Variable | Default | Description |
|---------------------|------------------|-------------------------------------------------------|
| `TZ` | `America/New_York` | Container timezone |
| `COMFYUI_HOST` | `0.0.0.0` | Listen address |
| `COMFYUI_PORT` | `8188` | ComfyUI port |
| `COMFYUI_EXTRA_ARGS`| `""` | Extra `main.py` flags (`--lowvram`, `--novram`, `--cpu`) |
| `CIVITAI_TOKEN` | `""` | [Civitai API key](https://civitai.com/user/account) for model downloads |
| `HF_TOKEN` | `""` | [HuggingFace token](https://huggingface.co/settings/tokens); also exported as `HUGGING_FACE_HUB_TOKEN` |
| `HF_HUB_OFFLINE` | `0` | `1` disables HF network (use only cached models) |
| `HUGGINGFACE_HUB_CACHE` | `/opt/ComfyUI/cache` | HF cache dir inside container (mounted from `./cache`) |
## Volumes
Host directories are mounted into the container (created automatically):
| Host | Container | Purpose |
|-----------------|-----------------------------|-------------------------------|
| `./models` | `/opt/ComfyUI/models` | Checkpoints, LoRA, VAE, etc. |
| `./custom_nodes`| `/opt/ComfyUI/custom_nodes` | Custom nodes |
| `./input` | `/opt/ComfyUI/input` | Input images |
| `./output` | `/opt/ComfyUI/output` | Generation outputs |
| `./user` | `/opt/ComfyUI/user` | User workflows |
| `./logs` | `/opt/ComfyUI/logs` | Logs |
## Install Without Docker
See [INSTALL.md](INSTALL.md).