https://github.com/jimlee2048/comfyui-docker
Customizable ComfyUI docker image with automatic environment setup
https://github.com/jimlee2048/comfyui-docker
comfyui docker docker-compose stable-diffusion
Last synced: 3 months ago
JSON representation
Customizable ComfyUI docker image with automatic environment setup
- Host: GitHub
- URL: https://github.com/jimlee2048/comfyui-docker
- Owner: jimlee2048
- License: mit
- Created: 2025-01-18T20:15:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-11T16:42:03.000Z (over 1 year ago)
- Last Synced: 2025-03-11T17:47:19.120Z (over 1 year ago)
- Topics: comfyui, docker, docker-compose, stable-diffusion
- Language: Python
- Homepage:
- Size: 116 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ComfyUI Docker Image
[](https://github.com/jimlee2048/comfyui-docker)
[](https://hub.docker.com/r/jimlee2048/comfyui-docker)
[](https://github.com/jimlee2048/comfyui-docker/actions/workflows/build-publish.yml)
[](https://hub.docker.com/r/jimlee2048/comfyui-docker)
[](https://hub.docker.com/r/jimlee2048/comfyui-docker)
A Customizable [ComfyUI](https://github.com/comfyanonymous/ComfyUI) docker image with automatic environment setup.
⚠️ **Note**: This image is designed for personal use with GUI access, not for production server deployments.
## Features
- Ready-to-use Python environment with common ML packages: `nunchaku`, `sageattention2++`,`sageattn3`, `xformers`, `transformers`, `onnxruntime`, `opencv-python`, etc.
- See [Dockerfile](Dockerfile.cuda) for complete details
- Automated management of custom nodes & models:
- Configuration-driven setup during startup
- Pre/Post initialization script hooks (supports `.py`, `.sh`, `.bat`, `.ps1`)
- Multiple config files support, with optional regex-based filter for flexible updates
- Built-in [aria2](https://github.com/aria2/aria2) for accelerated large model files downloads
- Use [cm-cli](https://github.com/ltdrdata/ComfyUI-Manager/blob/main/docs/en/cm-cli.md) to install custom nodes.
- Support install custom nodes from [Comfy Registry](https://registry.comfy.org/)
- Optional optimizations for users in the Chinese Mainland (mirrors for pip/Hugging Face/Civitai)
## Available Image Tags
| Image Tag | Compute Platform | PyTorch Version | Python Version | ComfyUI Version | Note |
| ------------------- | ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| `latest` / `vX.Y.Z` | [](https://hub.docker.com/r/nvidia/cuda/) | [](https://pytorch.org/) | [](https://www.python.org/) | [](https://github.com/comfyanonymous/ComfyUI/releases/latest) | Recommend |
| `nightly` | [](https://hub.docker.com/r/nvidia/cuda/) | [](https://pytorch.org/) | [](https://www.python.org/) | [](https://github.com/comfyanonymous/ComfyUI/tree/master) | |
## Environment Variables
| Variable | Description | Default |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| INIT_NODE | Enable automatic installs/removes of custom nodes at startup | true |
| UPDATE_NODE | Enable automatic updates of custom nodes at startup | false |
| INIT_MODEL | Enable automatic downloads/removes of models at startup | true |
| BOOT_CONFIG_INCLUDE | Regex pattern for including boot config files. | |
| BOOT_CONFIG_EXCLUDE | Regex pattern for excluding boot config files. | |
| COMFYUI_EXTRA_ARGS | Additional ComfyUI launch arguments. | |
| HF_API_TOKEN | [Hugging Face access token](https://huggingface.co/settings/tokens) for downloading access restricted models. | |
| CIVITAI_API_TOKEN | [Civitai API token](https://education.civitai.com/civitais-guide-to-downloading-via-api/#how-do-i-download-via-the-api) for downloading access restricted models. | |
| CN_NETWORK | Enable network optimization for Chinese Mainland users. Changes default HF/Civitai endpoints. | false |
| HF_ENDPOINT | Override the Hugging Face download endpoint. | `https://huggingface.co` (or `https://hf-mirror.com` if CN_NETWORK=`true`) |
| CIVITAI_ENDPOINT | Override the Civitai download endpoint. | `https://civitai.com` (or `https://civitai.work` if CN_NETWORK=`true`) |
## Quick Start
1. Clone this repository, mount `docker/` as working directory:
```bash
git clone https://github.com/jimlee2048/comfyui-docker
cd comfyui-docker/docker
```
2. Create and configure `docker/.env` file base on example:
```bash
cp example.env .env
```
see [docker/example.env](https://github.com/jimlee2048/comfyui-docker/blob/main/docker/example.env) for more details.
3. (Optional) Set up automatic node/model management:
- Set `INIT_NODE=true` or/and `INIT_MODEL=true` in `docker/.env`
- Create your boot config in `docker/config/`
see [docker/config/example.toml](https://github.com/jimlee2048/comfyui-docker/blob/main/docker/config/example.toml) for more details.
4. Create and configure `docker/compose.yml` file base on example:
```bash
cp compose.example.yml compose.yml
```
see [docker/compose.example.yml](https://github.com/jimlee2048/comfyui-docker/blob/main/docker/compose.example.yml) for more details.
5. Launch ComfyUI:
- Run in foreground to see logs, recommended for first run.
```bash
docker compose up
```
- Or in background as services.
```bash
docker compose up -d
```
First run may take longer due to node installation and model downloads.
6. Access ComfyUI at `http://localhost:8188`
7. To stop:
```bash
docker compose down
```
## Updates & Maintenance
### Configuration Changes
When modifying boot config or environment variables, do not use ComfyUI Manager's restart function on the web interface.
Instead, restart the container to apply changes:
```bash
docker compose down
docker compose up -d
```
### ComfyUI Updates
- Option 1: Use ComfyUI Manager in the web interface
- Option 2: Pull latest image:
```bash
docker compose pull
docker compose down
docker compose up -d
```
## TODO
- [ ] ROCm version for AMD GPU
- [ ] XPU version for Intel GPU