ComfyUI / docker /README.md
aleph65's picture
v6: document launcher scripts
73d1186 verified
|
Raw
History Blame Contribute Delete
5.22 kB
# plx1029/comfyui-qwen β€” prebaked ComfyUI image (H100 / RunPod)
Everything from the manual setup is baked in β€” **no reinstalling on new pods**:
- Base: `runpod/pytorch:1.0.2-cu1281-torch280-ubuntu2404` (torch 2.8.0+cu128, Python 3.12)
- **v3: everything lives in `/workspace`:**
- ComfyUI @ `35c1470935044be5610a81d46e57922a8a598c6c` at **`/workspace/ComfyUI`**
- workflows at **`/workspace/workflows/`** (`qwen-loras-very-good-nsfw.json`,
`qwen-edit-nsfw.json`, `head-swap-flux-klein.json`) β€” also baked into the
ComfyUI workflow browser
- **`/workspace/download_missing_models.sh`** β€” pick workflows, it fetches their
missing models from `hf.co/aleph65/ComfyUI` into place (prompts for HF token
or reads `$HF_TOKEN`); still on PATH via symlink
- **v4: ComfyUI does NOT auto-start** (was the default in v3). Run `comfy` in a
terminal, or set `COMFY_AUTOSTART=true` in the pod env to re-enable
(port **7865**, log `/workspace/comfyui.log`, auto-restart loop).
- **v5: fresh workflows + downloader on every boot** β€” `refresh-workspace.sh`
re-pulls `workflows/` (mirrored, deletions included),
`download_missing_models.sh`, and `README.md` from `hf.co/aleph65/ComfyUI` at
startup, using `HUGGING_FACE_ACCESS_TOKEN`/`HF_TOKEN` if set. On any failure
the existing copies stay. Set `WORKSPACE_REFRESH=false` to disable.
- **v5: `claude` alias** β€” in interactive shells `claude` runs
`IS_SANDBOX=1 claude --dangerously-skip-permissions` (via `/root/.bash_aliases`).
- **v6: launcher scripts in `/workspace`** β€” `start_comfy` (frees port 7865 then
runs `cd /workspace/ComfyUI && python main.py --listen 0.0.0.0 --port 7865
--enable-manager`) and `claude_start.sh` (`IS_SANDBOX=1 claude
--dangerously-skip-permissions`). Both are re-pulled from
`hf.co/aleph65/ComfyUI` on every boot by `refresh-workspace.sh`.
- rgthree-comfy @ `27b4f4c` in `custom_nodes/`
- comfyui-manager 4.2.2 + all pip deps preinstalled system-wide
- Manager config baked: `security_level = weak`, `network_mode = personal_cloud`
- `huggingface_hub` + `hf_transfer` preinstalled for fast model downloads
- [Claude Code](https://claude.com/claude-code) CLI preinstalled (`claude`), on PATH,
with `bypassPermissions` as the default permission mode
- The old image-root `/ComfyUI` copy is **removed** (whiteout) β€” `/workspace` is
the single source of truth.
Models are NOT in the image (keep them on the network volume, as before).
No secrets are baked in either (the image is public).
## Network volumes
If a network volume is mounted at `/workspace` it shadows the baked-in files.
On boot, `seed-workspace.sh` restores whatever is missing (`ComfyUI/`,
`workflows/`, `download_missing_models.sh`) from a compressed seed at
`/opt/workspace-seed.tar.gz` β€” **never overwriting existing files**, so models
and outputs already on the volume are untouched.
## Using it on RunPod
1. Create a template with container image `plx1029/comfyui-qwen:v6`.
2. Expose HTTP port **7865** (plus 8888/22 as usual).
3. Set `HUGGING_FACE_ACCESS_TOKEN` in the template env (used for the boot-time
workflow/script refresh and by `download_missing_models.sh`).
4. (Optional) attach your network volume at `/workspace`.
5. In a terminal: `download_missing_models.sh` to fetch models for your
workflows, then `comfy` to start ComfyUI (or set `COMFY_AUTOSTART=true`).
`COMFY_PORT` overrides the port. `COMFY_AUTOSTART=true` enables auto-start
(otherwise run `comfy` manually). `WORKSPACE_REFRESH=false` skips the boot
refresh.
## How the image was built
No Docker daemon exists on RunPod pods (or the build sandbox), so images are
assembled daemonlessly: v1 with [`crane`](https://github.com/google/go-containerregistry)
(pip-delta + git clones appended as one OCI layer); v2 with `skopeo` + `umoci`;
**v3 with `crane append`** β€” a single layer holding `/workspace` (ComfyUI +
workflows + downloader), the seed tarball, the new startup scripts, and a
whiteout of the old `/ComfyUI`, appended on top of v2 (the ~11 GB base is never
re-uploaded); **v4 with `crane append` on top of v3** (no-auto-start
`start-comfy.sh`, boot refresh of the downloader, updated seed tarball);
**v5 with `crane append` on top of v4** β€” a small layer holding
`refresh-workspace.sh`, the updated `start-comfy.sh`, `/root/.bash_aliases`,
and current `workflows/` + `download_missing_models.sh` copies;
**v6 with `crane append` on top of v5** β€” a small layer holding the two
launcher scripts (`/workspace/start_comfy`, `/workspace/claude_start.sh`) and
an updated `refresh-workspace.sh` that also re-pulls them at boot.
Note: `/opt/workspace-seed.tar.gz` inside v6 still holds the v4-era workflows
and does not include `start_comfy`/`claude_start.sh` β€” that's fine, the boot
refresh fetches them from the HF repo on the next start (only relevant when a
network volume shadows the baked-in `/workspace`).
`Dockerfile` in this directory is the reproducible equivalent for rebuilding on
any machine with real Docker (build from the repo root β€” the context needs
`download_missing_models.sh` and `workflows/`):
```bash
docker build -t plx1029/comfyui-qwen:v6 -f docker/Dockerfile .
docker push plx1029/comfyui-qwen:v6
```