Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
YanWenKun committed Apr 11, 2024
1 parent ecf2b63 commit 8819e43
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 142 deletions.
90 changes: 29 additions & 61 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Docker image for ComfyUI

image:https://github.com/YanWenKun/ComfyUI-Docker/actions/workflows/build-latest.yml/badge.svg["GitHub Workflow Status"]
image:https://github.com/YanWenKun/ComfyUI-Docker/actions/workflows/build-rocm.yml/badge.svg["GitHub Workflow Status"]
image:https://github.com/YanWenKun/ComfyUI-Docker/actions/workflows/build-latest.yml/badge.svg["GitHub Workflow Status",link="https://github.com/YanWenKun/ComfyUI-Docker/actions"]
image:https://github.com/YanWenKun/ComfyUI-Docker/actions/workflows/build-rocm.yml/badge.svg["GitHub Workflow Status",link="https://github.com/YanWenKun/ComfyUI-Docker/tree/main/rocm"]
image:https://github.com/YanWenKun/ComfyUI-Docker/actions/workflows/build-megapak.yml/badge.svg["GitHub Workflow Status",link="https://github.com/YanWenKun/ComfyUI-Docker/tree/main/megapak"]

*link:README.zh.adoc[>💡中文说明点我💡<]*

Expand All @@ -26,7 +27,7 @@ a Stable Diffusion GUI powering node-based workflow.

* NVIDIA GPU with ≥6GB VRAM
** For 4GB see <<q-n-a, Q & A>>.
** For AMD GPU see <<rocm, ROCm>>.
** For AMD GPU see link:rocm/README.adoc[ROCm].
* Latest NVIDIA GPU driver
** Either Game or Studio edition will work.
Expand All @@ -35,27 +36,12 @@ a Stable Diffusion GUI powering node-based workflow.
* Docker Installed
** Linux user may need to install https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html[NVIDIA Container Toolkit] (only on host OS). It will enable containers' GPU access.
** Windows user could use https://www.docker.com/products/docker-desktop/[Docker Desktop] with WSL2 enabled.
** For Podman users see: <<podman, Run with Podman>>.
## Usage - NVIDIA GPU

.A. Using `docker compose`
[source,sh]
----
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`
.A. Using `docker run`
[source,sh]
----
mkdir -p storage
Expand All @@ -65,65 +51,43 @@ docker run -it \
--gpus all \
-p 8188:8188 \
-v "$(pwd)"/storage:/home/runner \
--env CLI_ARGS="" \
-e CLI_ARGS="" \
yanwk/comfyui-boot:latest
----

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

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


[[rocm]]
## Usage - AMD GPU (Experimental)

NOTE: Recommend AMD users to run ComfyUI on Windows with ZLUDA. Running on Linux needs some experience.

NOTE: If you are using WSL2 with AMD/Intel GPU, consider *link:docs/wsl-directml.adoc[Run ComfyUI on WSL2 with DirectML]*.

NOTE: On Linux hosts, install
https://rocm.docs.amd.com/projects/radeon/en/latest/docs/install/install-radeon.html[Radeon software for Linux with ROCm]
first.

.C. Using `docker compose`
.B. Using `docker compose`
[source,sh]
----
git clone https://github.com/YanWenKun/ComfyUI-Docker.git
cd ComfyUI-Docker
docker compose -f docker-compose-rocm.yml up --detach
docker compose up --detach
----

[source,sh]
----
# 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 compose pull
docker compose up --detach --remove-orphans
docker image prune
----

.D. Using `docker run` (as root)
[source,sh]
----
mkdir -p storage
Once the app is loaded, visit http://localhost:8188/

docker run -it --rm \
--name comfyui-root \
--device=/dev/kfd --device=/dev/dri \
--group-add=video --ipc=host --cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
--security-opt label=disable \
-p 8188:8188 \
--env CLI_ARGS="--use-pytorch-cross-attention" \
--user root --workdir /root \
-v "$(pwd)"/storage:/root \
yanwk/comfyui-boot:rocm \
/bin/bash /home/scripts/root-wrapper.sh
----

Once the app is loaded, visit http://localhost:8188/
## Usage - AMD GPU

See link:rocm/README.adoc[ROCm].


[[q-n-a]]
Expand All @@ -147,7 +111,7 @@ https://github.com/comfyanonymous/ComfyUI/blob/master/comfy/cli_args.py[ComfyUI]

## Add some custom nodes

.Install a bunch of custom nodes that may save your time
.Install a bunch of custom nodes that may save your time
[%collapsible]
====
Note that most dependencies are bundled in the image, you don't need to manually install them.
Expand Down Expand Up @@ -208,7 +172,8 @@ https://github.com/WASasquatch/was-node-suite-comfyui[WAS Node Suite],
because it has some deps version
https://github.com/WASasquatch/was-node-suite-comfyui/blob/main/requirements.txt[fixed],
and is not under active development. +
However, the image's script only install one custom node (ComfyUI-Manager). You can safely install WAS NS via ComfyUI-Manager in a new deployment. If anything conflicts, just delete unwanted custom nodes and `.local` (or `local`) folder, and update/try-fix/reinstall custom nodes in ComfyUI-Manager.
However, the image's script only install one custom node (ComfyUI-Manager). You can safely install WAS NS via ComfyUI-Manager in a new deployment. +
If anything conflicts, just delete unwanted custom nodes and `.local` (or `local`) folder, and update/try-fix/reinstall custom nodes in ComfyUI-Manager.
====


Expand All @@ -226,12 +191,13 @@ Also, if you need to setup proxy, this script will start before `pre-start` and
----
[[podman]]
## Run with Podman
Podman is root-less by default. And https://www.tutorialworks.com/podman-rootless-volumes/[it's tricky] to bind-mount volume as non-root user inside rootless container.
https://docs.podman.io/en/latest/markdown/podman-run.1.html#mount-type-type-type-specific-option[Options] provided by Podman will chown files on host space, which probably is undesirable.
I recommend two different ways to workaround:
Recommend three different ways to workaround:
### 1. Go "root-ful" just like Docker
Expand Down Expand Up @@ -282,6 +248,8 @@ podman run -it --rm \
----
====
### 3. Use link:megapak/README.adoc[megapak] image
## Debugging
Expand Down
84 changes: 26 additions & 58 deletions README.zh.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# 用于 ComfyUI 的 Docker 镜像

image:https://github.com/YanWenKun/ComfyUI-Docker/actions/workflows/build-latest.yml/badge.svg["GitHub Workflow Status"]
image:https://github.com/YanWenKun/ComfyUI-Docker/actions/workflows/build-rocm.yml/badge.svg["GitHub Workflow Status"]
image:https://github.com/YanWenKun/ComfyUI-Docker/actions/workflows/build-latest.yml/badge.svg["GitHub Workflow Status",link="https://github.com/YanWenKun/ComfyUI-Docker/actions"]
image:https://github.com/YanWenKun/ComfyUI-Docker/actions/workflows/build-rocm.yml/badge.svg["GitHub Workflow Status",link="https://github.com/YanWenKun/ComfyUI-Docker/tree/main/rocm"]
image:https://github.com/YanWenKun/ComfyUI-Docker/actions/workflows/build-megapak.yml/badge.svg["GitHub Workflow Status",link="https://github.com/YanWenKun/ComfyUI-Docker/tree/main/megapak"]

image::docs/chart-concept.zh.svg["布局"]

Expand All @@ -24,7 +25,7 @@ https://hub.docker.com/r/yanwk/comfyui-boot[Docker 镜像]

* NVIDIA 显卡, ≥6GB 显存
** 4GB 方法见 <<q-n-a, Q & A>>
** AMD 显卡见 <<rocm, ROCm>>
** AMD 显卡见 link:rocm/README.zh.adoc[ROCm].
* 安装好最新的 NVIDIA 显卡驱动
** 游戏驱动或 Studio 驱动均可。
Expand All @@ -34,27 +35,12 @@ https://hub.docker.com/r/yanwk/comfyui-boot[Docker 镜像]
** Linux 用户可能需要安装 https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html[NVIDIA Container Toolkit] (使得容器可以访问宿主机的 GPU)。
** Windows 用户建议使用 https://www.docker.com/products/docker-desktop/[Docker Desktop] 并在安装时启用 WSL2,并 https://zhuanlan.zhihu.com/p/345645621[限制内存用量] 。
** 下载过程可能需要科学上网,在 Docker 设置中可以找到代理设置。
** Podman 用户参见: <<podman, 使用 Podman 运行>>。
## 运行方法 - NVIDIA 显卡

.方法 A 使用 `docker compose`
[source,sh]
----
git clone https://github.com/YanWenKun/ComfyUI-Docker.git
cd ComfyUI-Docker
docker compose up --detach
# 更新镜像(仅在 Python 组件版本过期时需要)
git pull
docker compose pull
docker compose up --detach --remove-orphans
docker image prune
----

.方法 B 使用 `docker run`
.方法 A 使用 `docker run`
[source,sh]
----
mkdir -p storage
Expand All @@ -64,64 +50,43 @@ docker run -it \
--gpus all \
-p 8188:8188 \
-v "$(pwd)"/storage:/home/runner \
--env CLI_ARGS="" \
-e CLI_ARGS="" \
yanwk/comfyui-boot:latest
----

[source,sh]
----
# 更新镜像(仅在 Python 组件版本过期时需要)
docker rm comfyui
docker pull yanwk/comfyui-boot:latest
# 接下来再运行一遍上述 'docker run' 即可
----

启动完成后,访问 http://localhost:8188/


[[rocm]]
## 运行方法 - AMD 显卡(尚在实验)

NOTE: 推荐 AMD 用户使用 Win11 + ZLUDA 方式运行,安装 AMD HIP SDK 并使用常见整合包运行即可(不要开启 xFormers),初次运行会花 15 分钟左右来编译代码,之后就和 CUDA 体验差不多了。不推荐缺乏经验的用户折腾 Linux 下的 ROCm。

NOTE: WSL2 + AMD/Intel GPU 可以考虑: *link:docs/wsl-directml.zh.adoc[在 WSL2 环境下通过 DirectML 运行 ComfyUI]*

NOTE: Linux 宿主机需要安装
https://rocm.docs.amd.com/projects/radeon/en/latest/docs/install/install-radeon.html[Radeon software for Linux with ROCm] 以让 Docker 支持 GPU,各发行版可能安装方式不同。

.方法 C 使用 `docker compose`
.方法 B 使用 `docker compose`
[source,sh]
----
git clone https://github.com/YanWenKun/ComfyUI-Docker.git
cd ComfyUI-Docker
docker compose -f docker-compose-rocm.yml up --detach
docker compose up --detach
----

[source,sh]
----
# 更新镜像(仅在 Python 组件版本过期时需要)
git pull
docker compose -f docker-compose-rocm.yml pull
docker compose -f docker-compose-rocm.yml up --detach --remove-orphans
docker compose pull
docker compose up --detach --remove-orphans
docker image prune
----

.方法 D 使用 `docker run`(root 身份)
[source,sh]
----
mkdir -p storage
启动完成后,访问 http://localhost:8188/

docker run -it --rm \
--name comfyui-root \
--device=/dev/kfd --device=/dev/dri \
--group-add=video --ipc=host --cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
--security-opt label=disable \
-p 8188:8188 \
--env CLI_ARGS="--use-pytorch-cross-attention" \
--user root --workdir /root \
-v "$(pwd)"/storage:/root \
yanwk/comfyui-boot:rocm \
/bin/bash /home/scripts/root-wrapper.sh
----

启动完成后,访问 http://localhost:8188/
## 运行方法 - AMD 显卡

参见 link:rocm/README.zh.adoc[ROCm]。


[[q-n-a]]
Expand Down Expand Up @@ -245,15 +210,16 @@ echo "[INFO] Proxy set to $HTTP_PROXY"
====
[[podman]]
## 使用 Podman 运行
Podman 默认是 root-less 的,不需要 sudo,这也给挂载目录
关于文件权限:Podman 默认是 root-less 的,不需要 sudo,这也给挂载目录
https://www.tutorialworks.com/podman-rootless-volumes/[带来了限制] 。 +
Podman 默认挂载文件为 root 身份,而想要在容器内挂载为非 root 用户,Podman 提供的
https://docs.podman.io/en/latest/markdown/podman-run.1.html#mount-type-type-type-specific-option[选项]
则会对主机上的文件执行 `chown`,变成和容器内一样的 uid 和 gid,给文件管理带来混乱。
这里推荐两种不同的方式绕过
这里推荐三种不同的方式绕过
### 1. 像 Docker 一样 "root-ful"
Expand Down Expand Up @@ -304,6 +270,8 @@ podman run -it --rm \
----
====
### 3. 改用 link:megapak/README.zh.adoc[megapak] 镜像
## 一些方便 Debug 的命令
Expand Down
30 changes: 8 additions & 22 deletions docs/README-DockerHub.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# ComfyUI

[![GitHub Workflow Status](https://github.com/YanWenKun/ComfyUI-Docker/actions/workflows/build-latest.yml/badge.svg)](https://github.com/YanWenKun/ComfyUI-Docker/actions/workflows/build-latest.yml)
[![GitHub Workflow Status](https://github.com/YanWenKun/ComfyUI-Docker/actions/workflows/build-rocm.yml/badge.svg)](https://github.com/YanWenKun/ComfyUI-Docker/actions/workflows/build-rocm.yml)
[![GitHub Workflow Status](https://github.com/YanWenKun/ComfyUI-Docker/actions/workflows/build-latest.yml/badge.svg)](https://github.com/YanWenKun/ComfyUI-Docker/actions)
[![GitHub Workflow Status](https://github.com/YanWenKun/ComfyUI-Docker/actions/workflows/build-rocm.yml/badge.svg)](https://github.com/YanWenKun/ComfyUI-Docker/tree/main/rocm)
[![GitHub Workflow Status](https://github.com/YanWenKun/ComfyUI-Docker/actions/workflows/build-megapak.yml/badge.svg)](https://github.com/YanWenKun/ComfyUI-Docker/tree/main/megapak)

**[CHECK THE GITHUB REPO](https://github.com/YanWenKun/ComfyUI-Docker)**

Expand All @@ -23,27 +24,12 @@ docker run -it --rm \
yanwk/comfyui-boot:latest
```

## Usage - AMD GPU (Experimental)

```sh
mkdir -p storage
Once the app is loaded, visit http://localhost:8188/

docker run -it --rm \
--name comfyui-root \
--device=/dev/kfd --device=/dev/dri \
--group-add=video --ipc=host --cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
--security-opt label=disable \
-p 8188:8188 \
--env CLI_ARGS="--use-pytorch-cross-attention" \
--user root --workdir /root \
-v "$(pwd)"/storage:/root \
yanwk/comfyui-boot:rocm \
/bin/bash /home/scripts/root-wrapper.sh
```
## More Usage

## More
- [AMD GPU with ROCm](https://github.com/YanWenKun/ComfyUI-Docker/tree/main/rocm)

Once the app is loaded, visit http://localhost:8188/
- ["Megapak" (all-in-one bundle)](https://github.com/YanWenKun/ComfyUI-Docker/tree/main/megapak)

For detailed `docker run` commands, check the doc on [GitHub repo](https://github.com/YanWenKun/ComfyUI-Docker).
- For docs and image detail, check [GitHub Page](https://github.com/YanWenKun/ComfyUI-Docker).
2 changes: 2 additions & 0 deletions rocm/README.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Run ComfyUI with ROCm on AMD GPU

*link:README.zh.adoc[中文说明]*

## In case of WSL2

If you are using WSL2 with AMD/Intel GPU, try
Expand Down
2 changes: 1 addition & 1 deletion rocm/README.zh.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 基于 AMD GPU + ROCm 运行 ComfyUI

## 提醒: WSL2
## 提醒: WSL2 用户

如果你在用 WSL2 + AMD/Intel GPU, 可以考虑:
link:../docs/wsl-directml.zh.adoc[在 WSL2 环境下通过 DirectML 运行 ComfyUI]。
Expand Down

0 comments on commit 8819e43

Please sign in to comment.