I made a docker image to run ComfyUI on my Spark. I thought sharing it would be helpful for some of you.
SSH to you Spark and made a directory in your home directory to hold ComfyUI model checkpoints. Change your directory to it and download a stable diffusion:
mkdir comfyui_checkpoints
cd comfyui_checkpoints
wget https://huggingface.co/Comfy-Org/stable-diffusion-v1-5-archive/resolve/main/v1-5-pruned-emaonly-fp16.safetensors
pull the docker image:
docker pull knamdar/spark_comfy_ui:v1
run it:
docker run --rm -it
–gpus all
-p 8188:8188
-v ~/comfyui_checkpoints:/workspace/ComfyUI/models/checkpoints
–name spark_comfy_ui
knamdar/spark_comfy_ui:v1
bash -c “cd /workspace/ComfyUI && python main.py --listen 0.0.0.0 --port 8188”
Lastly, you need to access your ComfyUI panel through DGX_IP_ADDRESS:8188
You can also add this to your NVIDIA Sync:
Connect to your DGX using NVIDIA Sync
Go to settings
Go to the Custom Tab
Click on +Add New
Name it “ComfyUI“
Port: 8188
Check “launch in terminal“
Use this as Launch Script:
#!/usr/bin/env bash
set -euo pipefail
IMAGE=“knamdar/spark_comfy_ui:v1”
PORT=“8188”
CHECKPOINTS=“$HOME/comfyui_checkpoints”
Ensure Docker is available
if ! docker info >/dev/null 2>&1; then
echo “Error: Docker daemon not reachable.” >&2
exit 1
fi
echo “Starting ComfyUI (ephemeral container)…”
echo “Press Ctrl+C to stop.”
docker run --rm -it
–gpus all
-p ${PORT}:${PORT}
-v “${CHECKPOINTS}:/workspace/ComfyUI/models/checkpoints”
“${IMAGE}”
bash -c “cd /workspace/ComfyUI && python main.py --listen 0.0.0.0 --port ${PORT}”
did you see latency comparing with a “non docker” version of comfuy ?
I didn’t compare. My goal was to make it easy to install ComfyUi, especially when there are custom modules and settings. It would be interesting to compare the latency. Nonetheless, I didn’t notice anything odd in terms of latency.
Hi,
are you willing to share a Dockerfile?
Thanks.
jv14
December 22, 2025, 11:46am
6
If anyone needs this as a compose code:
See uploaded ZIP file for .yaml file.
I deployed this image with the code above in Portainer and it is working. Adjust to your liking (volumes, etc.).
Can be combined with traefik by adding necessary labels and etc. to make it available behind a proper URL with a Let’s Encrypt certificate.
comfyui_dgx_spark.zip (451 Bytes)
I did not have a docker file. I pulled the latest pytorch image from NGC and installed ComfyUI there. I had to take care of many lib conflicts. Once it worked, I just committed.
You can try making a docker file using the image or (a bit simpler) through comparing the pytorch base and mine.
I use this as my Dockerfile for ComfyUI:
FROM nvcr.io/nvidia/pytorch:25.11-py3
WORKDIR /app
RUN pip install --upgrade pip && \
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu130
RUN git clone https://github.com/comfyanonymous/ComfyUI.git /app/ComfyUI
RUN pip install -r /app/ComfyUI/requirements.txt
EXPOSE 8188
CMD ["python", "/app/ComfyUI/main.py", "--listen", "0.0.0.0", "--port", "8188"]
I also used this start point:
CMD ["python", "/app/ComfyUI/main.py", "--listen", "0.0.0.0", "--port", "8188", "--highvram", "--force-fp16", "--use-pytorch-cross-attention", "--reserve-vram", "2"]
I have not noticed any better performance.