Comfyui实例容器运行横向扩展

avatar
作者
筋斗云
阅读量:0

说明:此部署是基于之前的Comfyui部署进行的,为了实例的横向扩展
在此感谢@YanWenKun大佬提供的基础镜像
镜像地址docker pull yanwk/comfyui-boot:latest
此处机器配置为16C64G + 4090*1 Ubuntu 24.04 64位

安装docker

sudo apt-get update sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc echo   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \   $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install docker-ce 

安装nvidia-container-toolkit
安装此工具支持容器调用gpu

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 sed -i -e '/experimental/ s/^#//g' /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 systemctl restart docker 

容器启动Comfyui实例
在Comfyui挂载目录中创建.download-complete文件,禁止启动的时候下载数据

touch /data/comfyui/.download-complete docker run -d -it --name comfyui --gpus "device=0" -p 30300:8188 --user root --disable-smart-memory -v /data/comfyui:/home/runner image-repository/public/comfyui:base 

目的

做此横向扩展作用于单机多卡机器,使一个comfyui实例使用一张或者多张指定显卡,并用一个upstream程序获取所有实例队列情况,使其提供单独的对外接口,后台可以实现自动调度。以此应对队列等待情况

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!