Skip to content

Artifice-Arthouse/Comfy

 
 

Repository files navigation

Docker image for ComfyUI

GitHub Workflow Status
Concept Design

This repo is for Docker images that runs ComfyUI - a Stable Diffusion GUI powering node-based workflow.

How it works

  1. At first start, a script will download latest ComfyUI, some custom nodes and models.

  2. The whole ComfyUI will be stored in a local folder (./storage/ComfyUI).

  3. If you already have a ComfyUI bundle, put it there and make an empty file (./storage/.download-complete) so the start script will skip downloading.

  4. You can update ComfyUI & its custom nodes via ComfyUI-Manager (in ComfyUI web page).

Prerequisites

  • NVIDIA GPU with ≥6GB VRAM

  • Latest NVIDIA GPU Drivers, Both Game and Studio version will work.

    • Only install drivers on your host OS. You don’t need to install drivers inside containers.

  • Docker Installed

Usage - NVIDIA GPU

A. Using docker compose
git clone https://github.com/YanWenKun/ComfyUI-Docker.git

cd ComfyUI-Docker

docker compose up --detach

# Update image (only when Python components are outdated)
git pull
docker compose pull
docker compose up --detach --remove-orphans
docker image prune
B. Using docker run
mkdir -p storage

docker run -it \
  --name comfyui \
  --gpus all \
  -p 8188:8188 \
  -v "$(pwd)"/storage:/home/runner \
  --env CLI_ARGS="" \
  yanwk/comfyui-boot:latest

# Update image (only when Python components are outdated)
docker rm comfyui
docker pull yanwk/comfyui-boot:latest
# Then re-run 'docker run' above again

Once the app is loaded, visit http://localhost:8188/

Usage - AMD GPU (Experimental)

Note
If you are using WSL2 with AMD/Intel GPU, consider Run ComfyUI on WSL2 with DirectML
C. Using docker compose
git clone https://github.com/YanWenKun/ComfyUI-Docker.git

cd ComfyUI-Docker

docker compose -f docker-compose-rocm.yml up --detach

# Update image (only when Python components are outdated)
git pull
docker compose -f docker-compose-rocm.yml pull
docker compose -f docker-compose-rocm.yml up --detach --remove-orphans
docker image prune
D. Using docker run
mkdir -p storage

docker run -it \
  --name comfyui \
  --gpus all \
  -p 8188:8188 \
  -v "$(pwd)"/storage:/home/runner \
  --env CLI_ARGS="--use-pytorch-cross-attention" \
  --device=/dev/kfd --device=/dev/dri \
  --group-add=video --ipc=host --cap-add=SYS_PTRACE \
  --security-opt seccomp=unconfined \
  yanwk/comfyui-boot:rocm

# Update image (only when Python components are outdated)
docker rm comfyui
docker pull yanwk/comfyui-boot:rocm
# Then re-run 'docker run' above again

Once the app is loaded, visit http://localhost:8188/

Q & A

Q: My GPU has only 4GB VRAM
A: Add --lowvram to CLI_ARGS.

Q: Adding --lowvram still out-of-memory
A: Use --novram instead. It will use CPU RAM.

Q: How to run on CPU?
A: Add --cpu to CLI_ARGS. It’s pretty slow.

More CLI_ARGS available at ComfyUI.

Some commands for debugging

Build the image, print all logs to STDOUT.
docker build . --progress=plain -f Dockerfile -t yanwk/comfyui-boot:latest
Run a one-time container
docker run -it --rm \
  --gpus all -p 8188:8188 \
  -v "$(pwd)"/storage:/home/runner \
  --env CLI_ARGS="" \
  yanwk/comfyui-boot:latest
Run into a root bash
docker run -it --rm \
  --gpus all -p 8188:8188 \
  -v "$(pwd)"/storage:/home/runner \
  -e CLI_ARGS="" \
  --user root \
  yanwk/comfyui-boot:latest /bin/bash

License

This open source license is written and valid both in Chinese and English, how good is that!

Releases

No releases published

Packages

No packages published

Languages

  • Dockerfile 78.7%
  • Shell 21.3%