first :)
This commit is contained in:
57
README.md
57
README.md
@@ -1,2 +1,57 @@
|
||||
# comfyui-docker
|
||||
# ComfyUI Docker Setup
|
||||
|
||||
Hey there! This repository sets up ComfyUI, a powerful node-based interface for Stable Diffusion, using Docker. I've created separate configurations for AMD, Intel, and Nvidia GPUs to hopefully get everyone up and running smoothly.
|
||||
|
||||
## Summary
|
||||
|
||||
This `docker-compose.yml` file defines three ComfyUI services:
|
||||
|
||||
* **comfyui-amd:** Optimized for AMD GPUs.
|
||||
* **comfyui-intel:** Optimized for Intel GPUs.
|
||||
* **comfyui-nvidia:** Configured for Nvidia GPUs.
|
||||
|
||||
You'll be able to access ComfyUI through your browser at `http://localhost:8188` (assuming you're running this locally) or `http://<ip>:8188`.
|
||||
|
||||
## Dependencies
|
||||
|
||||
Before you start, make sure you have the following installed:
|
||||
|
||||
* **Docker:** You'll need Docker installed and running on your system. [https://docs.docker.com/get-docker/](https://docs.docker.com/get-docker/)
|
||||
* **Docker Compose:** Docker Compose is used to define and run multi-container Docker applications. It's usually bundled with Docker Desktop, but if not, you can install it separately: [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/)
|
||||
* **GPU Drivers:** Make sure you have the latest drivers installed for your GPU (AMD, Intel, or Nvidia).
|
||||
* **Models:** You'll need to download the Stable Diffusion models and place them in the `./models` directory. (This directory will be mounted into the container).
|
||||
|
||||
## Getting Started
|
||||
|
||||
Here's how to get everything up and running:
|
||||
|
||||
1. **Clone the repository:** Clone this repository to your local machine.
|
||||
|
||||
2. **Download Models:** Download your preferred Stable Diffusion models (e.g., checkpoints, VAEs, LoRAs) and place them in the `./models` directory.
|
||||
|
||||
3. **Choose your profile:** Pick the profile corresponding to your GPU: `comfyui-amd`, `comfyui-intel`, or `comfyui-nvidia`.
|
||||
|
||||
4. **Run Docker Compose:** Open your terminal, navigate to the directory where you cloned the repository, and run the following command, specifying the profile:
|
||||
|
||||
```bash
|
||||
docker-compose --profile comfyui-amd up -d # For AMD
|
||||
docker-compose --profile comfyui-intel up -d # For Intel
|
||||
docker-compose --profile comfyui-nvidia up -d # For Nvidia
|
||||
```
|
||||
|
||||
The `-d` flag runs the containers in detached mode (in the background).
|
||||
|
||||
5. **Access ComfyUI:** Once the containers are running, open your web browser and go to `http://localhost:8188`. You should see the ComfyUI interface.
|
||||
|
||||
**To stop the containers:**
|
||||
|
||||
```bash
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
**Important Notes:**
|
||||
|
||||
* The `CLI_ARGS` environment variables in each service are specific optimizations for each GPU type. You can customize these if you want to experiment with different settings.
|
||||
* The `./output` and `./user` directories are used for saving generated images and custom workflows, respectively.
|
||||
|
||||
Let me know if you run into any issues or have suggestions for improvements!
|
||||
68
docker-compose.yml
Normal file
68
docker-compose.yml
Normal file
@@ -0,0 +1,68 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
comfyui-amd:
|
||||
container_name: comfyui-amd
|
||||
build:
|
||||
context: ./services/amd
|
||||
profiles: ["comfyui-amd"]
|
||||
ports:
|
||||
- "8188:8188"
|
||||
volumes:
|
||||
- "./models:/ComfyUI/models"
|
||||
- "./output:/ComfyUI/output"
|
||||
- "./user:/ComfyUI/user"
|
||||
environment:
|
||||
- CLI_ARGS=--disable-cuda-malloc --disable-smart-memory
|
||||
- HSA_OVERRIDE_GFX_VERSION=10.3.0 # For AMD Radeon RX 6650 XT
|
||||
- MIOPEN_FIND_MODE=FAST
|
||||
devices:
|
||||
- /dev/dri/renderD128:/dev/dri/renderD128
|
||||
- /dev/dri/card0:/dev/dri/card0
|
||||
- /dev/kfd:/dev/kfd
|
||||
restart: unless-stopped
|
||||
|
||||
comfyui-intel:
|
||||
container_name: comfyui-intel
|
||||
build:
|
||||
context: ./services/intel
|
||||
profiles: ["comfyui-intel"]
|
||||
ports:
|
||||
- "8188:8188"
|
||||
volumes:
|
||||
- "./models:/ComfyUI/models"
|
||||
- "./output:/ComfyUI/output"
|
||||
- "./user:/ComfyUI/user"
|
||||
environment:
|
||||
- CLI_ARGS=--disable-ipex-optimize --use-pytorch-cross-attention --reserve-vram 9.5
|
||||
- MIOPEN_FIND_MODE=2
|
||||
- MIGRAPHX_MLIR_USE_SPECIFIC_OPS="attention"
|
||||
devices:
|
||||
- /dev/dri/renderD128:/dev/dri/renderD128
|
||||
- /dev/dri/card0:/dev/dri/card0
|
||||
restart: unless-stopped
|
||||
|
||||
comfyui-nvidia:
|
||||
container_name: comfyui-nvidia
|
||||
build:
|
||||
context: ./services/nvidia
|
||||
profiles: ["comfyui-nvidia"]
|
||||
ports:
|
||||
- "8188:8188"
|
||||
volumes:
|
||||
- "./models:/ComfyUI/models"
|
||||
- "./output:/ComfyUI/output"
|
||||
- "./user:/ComfyUI/user"
|
||||
environment:
|
||||
- CLI_ARGS=""
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
count: all
|
||||
capabilities:
|
||||
- gpu
|
||||
- compute
|
||||
- utility
|
||||
56
services/amd/Dockerfile
Normal file
56
services/amd/Dockerfile
Normal file
@@ -0,0 +1,56 @@
|
||||
FROM rocm/dev-ubuntu-24.04:latest
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
git \
|
||||
libgl1 \
|
||||
libglib2.0-0 \
|
||||
libglx-mesa0 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create User Permissions
|
||||
ARG DOCKER_USER=default_user
|
||||
RUN useradd -m "$DOCKER_USER"
|
||||
|
||||
# Clone vladmandic's stable diffusion
|
||||
RUN \
|
||||
git clone --depth 1 --depth 1 https://github.com/comfyanonymous/ComfyUI
|
||||
|
||||
WORKDIR /ComfyUI/custom_nodes/
|
||||
RUN git clone --depth 1 https://github.com/ltdrdata/ComfyUI-Manager /ComfyUI/custom_nodes/comfyui-manager && \
|
||||
git clone --depth 1 https://github.com/SeanScripts/ComfyUI-Unload-Model.git /ComfyUI/custom_nodes/ComfyUI-Unload-Model && \
|
||||
git clone --depth 1 https://github.com/ssitu/ComfyUI_UltimateSDUpscale --recursive /ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale && \
|
||||
git clone --depth 1 https://github.com/ltdrdata/ComfyUI-Impact-Pack /ComfyUI/custom_nodes/ComfyUI-Impact-Pack && \
|
||||
git clone --depth 1 https://github.com/ltdrdata/ComfyUI-Impact-Subpack /ComfyUI/custom_nodes/ComfyUI-Impact-Subpack && \
|
||||
git clone --depth 1 https://github.com/talesofai/comfyui-browser /ComfyUI/custom_nodes/comfyui-browser && \
|
||||
git clone --depth 1 https://github.com/SEkINVR/ComfyUI-SaveAs.git /ComfyUI/custom_nodes/ComfyUI-SaveAs
|
||||
|
||||
WORKDIR /ComfyUI
|
||||
|
||||
RUN pip install --no-cache-dir --break-system-packages --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.4
|
||||
#RUN pip install --no-cache-dir --break-system-packages torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.3
|
||||
|
||||
# Install Python dependencies
|
||||
RUN pip install --no-cache-dir --break-system-packages -r requirements.txt && \
|
||||
pip install --no-cache-dir --break-system-packages -r /ComfyUI/custom_nodes/comfyui-manager/requirements.txt && \
|
||||
pip install --no-cache-dir --break-system-packages -r /ComfyUI/custom_nodes/ComfyUI-Impact-Pack/requirements.txt && \
|
||||
pip install --no-cache-dir --break-system-packages -r /ComfyUI/custom_nodes/ComfyUI-Impact-Subpack/requirements.txt && \
|
||||
pip install --no-cache-dir --break-system-packages -r /ComfyUI/custom_nodes/comfyui-browser/requirements.txt && \
|
||||
pip install --no-cache-dir --break-system-packages -r /ComfyUI/custom_nodes/ComfyUI-SaveAs/requirements.txt && \
|
||||
pip install --no-cache-dir --break-system-packages gitpython psutil
|
||||
|
||||
# Set ownership and move models directory
|
||||
RUN chown -R $DOCKER_USER:$DOCKER_USER /ComfyUI && \
|
||||
mv /ComfyUI/models /ComfyUI/models.orig
|
||||
|
||||
# Copy start script
|
||||
COPY ./start.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/start.sh
|
||||
|
||||
# Switch to non-root user
|
||||
USER $DOCKER_USER
|
||||
WORKDIR /ComfyUI
|
||||
|
||||
CMD ["/usr/local/bin/start.sh"]
|
||||
5
services/amd/start.sh
Normal file
5
services/amd/start.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
echo "COPYING"
|
||||
cp -rf /ComfyUI/models.orig/* /ComfyUI/models/
|
||||
echo "START"
|
||||
python3 main.py --listen --lowvram "${CLI_ARGS}"
|
||||
58
services/intel/Dockerfile
Normal file
58
services/intel/Dockerfile
Normal file
@@ -0,0 +1,58 @@
|
||||
FROM intel/oneapi-runtime:latest
|
||||
|
||||
ENV PIP_BREAK_SYSTEM_PACKAGES=1
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
ca-certificates \
|
||||
git \
|
||||
python3 \
|
||||
python3-pip \
|
||||
libgl1 \
|
||||
libglx-mesa0 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create User Permissions
|
||||
ARG DOCKER_USER=default_user
|
||||
RUN useradd -m "$DOCKER_USER"
|
||||
|
||||
# Clone vladmandic's stable diffusion
|
||||
RUN \
|
||||
git clone --depth 1 https://github.com/comfyanonymous/ComfyUI
|
||||
WORKDIR /ComfyUI
|
||||
|
||||
WORKDIR /ComfyUI/custom_nodes/
|
||||
RUN git clone --depth 1 https://github.com/ltdrdata/ComfyUI-Manager /ComfyUI/custom_nodes/comfyui-manager && \
|
||||
git clone --depth 1 https://github.com/SeanScripts/ComfyUI-Unload-Model.git /ComfyUI/custom_nodes/ComfyUI-Unload-Model && \
|
||||
git clone --depth 1 https://github.com/ssitu/ComfyUI_UltimateSDUpscale --recursive /ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale && \
|
||||
git clone --depth 1 https://github.com/ltdrdata/ComfyUI-Impact-Pack /ComfyUI/custom_nodes/ComfyUI-Impact-Pack && \
|
||||
git clone --depth 1 https://github.com/ltdrdata/ComfyUI-Impact-Subpack /ComfyUI/custom_nodes/ComfyUI-Impact-Subpack && \
|
||||
git clone --depth 1 https://github.com/talesofai/comfyui-browser /ComfyUI/custom_nodes/comfyui-browser && \
|
||||
git clone --depth 1 https://github.com/SEkINVR/ComfyUI-SaveAs.git /ComfyUI/custom_nodes/ComfyUI-SaveAs
|
||||
|
||||
WORKDIR /ComfyUI
|
||||
RUN pip install --no-cache-dir --break-system-packages torch==2.10.0.dev20250911+xpu torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/xpu
|
||||
|
||||
# Install Python dependencies
|
||||
RUN pip install --no-cache-dir --break-system-packages -r requirements.txt && \
|
||||
pip install --no-cache-dir --break-system-packages -r /ComfyUI/custom_nodes/comfyui-manager/requirements.txt && \
|
||||
pip install --no-cache-dir --break-system-packages -r /ComfyUI/custom_nodes/ComfyUI-Impact-Pack/requirements.txt && \
|
||||
pip install --no-cache-dir --break-system-packages -r /ComfyUI/custom_nodes/ComfyUI-Impact-Subpack/requirements.txt && \
|
||||
pip install --no-cache-dir --break-system-packages -r /ComfyUI/custom_nodes/comfyui-browser/requirements.txt && \
|
||||
pip install --no-cache-dir --break-system-packages -r /ComfyUI/custom_nodes/ComfyUI-SaveAs/requirements.txt && \
|
||||
pip install --no-cache-dir --break-system-packages gitpython psutil
|
||||
|
||||
# Set ownership and move models directory
|
||||
RUN chown -R $DOCKER_USER:$DOCKER_USER /ComfyUI && \
|
||||
mv /ComfyUI/models /ComfyUI/models.orig
|
||||
|
||||
# Copy start script
|
||||
COPY ./start.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/start.sh
|
||||
|
||||
# Switch to non-root user
|
||||
USER $DOCKER_USER
|
||||
WORKDIR /ComfyUI
|
||||
|
||||
CMD ["/usr/local/bin/start.sh"]
|
||||
5
services/intel/start.sh
Normal file
5
services/intel/start.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
echo "COPYING"
|
||||
cp -rf /ComfyUI/models.orig/* /ComfyUI/models/
|
||||
echo "START"
|
||||
python3 main.py --listen "${CLI_ARGS}"
|
||||
55
services/nvidia/Dockerfile
Normal file
55
services/nvidia/Dockerfile
Normal file
@@ -0,0 +1,55 @@
|
||||
FROM nvidia/cuda:13.0.2-cudnn-devel-ubuntu24.04
|
||||
|
||||
ENV PIP_BREAK_SYSTEM_PACKAGES=1
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
ca-certificates \
|
||||
git \
|
||||
python3 \
|
||||
python3-pip \
|
||||
libgl1 \
|
||||
libglx-mesa0 \
|
||||
libglib2.0-0 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create User Permissions
|
||||
ARG DOCKER_USER=default_user
|
||||
RUN useradd -m "$DOCKER_USER"
|
||||
|
||||
# Clone vladmandic's stable diffusion
|
||||
RUN git clone --depth 1 https://github.com/comfyanonymous/ComfyUI
|
||||
|
||||
WORKDIR /ComfyUI/custom_nodes/
|
||||
RUN \
|
||||
git clone --depth 1 https://github.com/ltdrdata/ComfyUI-Manager \
|
||||
&& git clone --depth 1 https://github.com/SeanScripts/ComfyUI-Unload-Model.git \
|
||||
&& git clone --depth 1 https://github.com/ssitu/ComfyUI_UltimateSDUpscale --recursive \
|
||||
&& git clone --depth 1 https://github.com/ltdrdata/ComfyUI-Impact-Pack \
|
||||
&& git clone --depth 1 https://github.com/ltdrdata/ComfyUI-Impact-Subpack \
|
||||
&& git clone --depth 1 https://github.com/talesofai/comfyui-browser \
|
||||
&& git clone --depth 1 https://github.com/SEkINVR/ComfyUI-SaveAs.git
|
||||
|
||||
WORKDIR /ComfyUI
|
||||
|
||||
RUN pip install --break-system-packages -r requirements.txt \
|
||||
&& pip install --break-system-packages -r /ComfyUI/custom_nodes/comfyui-manager/requirements.txt \
|
||||
&& pip install --break-system-packages -r /ComfyUI/custom_nodes/ComfyUI-Impact-Pack/requirements.txt \
|
||||
&& pip install --break-system-packages -r /ComfyUI/custom_nodes/ComfyUI-Impact-Subpack/requirements.txt \
|
||||
&& pip install --break-system-packages -r /ComfyUI/custom_nodes/comfyui-browser/requirements.txt \
|
||||
&& pip install --break-system-packages -r /ComfyUI/custom_nodes/ComfyUI-SaveAs/requirements.txt
|
||||
&& pip install --break-system-packages gitpython psutil
|
||||
|
||||
# Set ownership and move models directory
|
||||
RUN chown -R $DOCKER_USER:$DOCKER_USER /ComfyUI && \
|
||||
mv /ComfyUI/models /ComfyUI/models.orig
|
||||
|
||||
# Copy start script
|
||||
COPY ./start.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/start.sh
|
||||
|
||||
# Switch to non-root user
|
||||
USER $DOCKER_USER
|
||||
WORKDIR /ComfyUI
|
||||
|
||||
CMD ["/usr/local/bin/start.sh"]
|
||||
5
services/nvidia/start.sh
Normal file
5
services/nvidia/start.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
echo "COPYING"
|
||||
cp -rf /ComfyUI/models.orig/* /ComfyUI/models/
|
||||
echo "START"
|
||||
python3 main.py --listen "${CLI_ARGS}"
|
||||
Reference in New Issue
Block a user