ComfyUI Local Docker Setup: Private Generative AI Without Cloud Telemetry (2026)
Run ComfyUI locally in Docker with NVIDIA CUDA or AMD ROCm passthrough. Step-by-step node manager setup, persistent volumes, and secure remote tunneling.
ComfyUI Local Docker Setup: Private Generative AI Without Cloud Telemetry (2026)
Executive Summary & Architecture Overview
Generative image AI platforms like Midjourney, DALL-E 3, and proprietary cloud services log every prompt, retain commercial usage rights, and censor technical outputs. For artists, developers, and homelabbers seeking zero telemetry, full privacy, and unlimited generation capabilities, ComfyUI has become the industry standard node-based execution engine for Stable Diffusion (SD 1.5, SDXL, Flux.1, and SD 3.5).
Unlike monolithic WebUIs, ComfyUI executes modular computation graphs with optimized VRAM paging, reducing memory overhead by up to 40% and supporting high-resolution image rendering on consumer GPUs.
+--------------------------------------------------------------------------+
| User Web Browser (Graph Editor UI) |
+------------------------------------^-------------------------------------+
| HTTP / WebSocket (Port 8188)
+------------------------------------v-------------------------------------+
| ComfyUI Runtime Container |
| - PyTorch 2.4+ / CUDA 12.4 Runtime |
| - Dynamic VRAM Memory Paging |
| - Custom Nodes Manager (ComfyUI-Manager) |
+------------------------------------^-------------------------------------+
| Persistent Host Mounts
+------------------------------------v-------------------------------------+
| Host NVMe Storage Subsystem |
| - /models/checkpoints (Base Models: SDXL, Flux) |
| - /models/loras (Style Adaptations) |
| - /models/vae & /models/clip |
| - /output (Rendered PNGs with embedded workflows) |
+--------------------------------------------------------------------------+
Hardware & System Requirements
| Specification | Minimum (SD 1.5 / SDXL Turbo) | Recommended (Flux.1 Dev / High-Res SDXL) |
|---|---|---|
| GPU (NVIDIA) | 8 GB VRAM (RTX 3060 / 4060) | 16 GB - 24 GB VRAM (RTX 3090 / 4090) |
| GPU (AMD) | 12 GB VRAM (RX 6700XT with ROCm 6.1) | 16 GB - 24 GB VRAM (RX 7900XT / 7900XTX) |
| Host RAM | 16 GB DDR4 | 32 GB - 64 GB DDR5 |
| Storage | 100 GB NVMe SSD | 1 TB+ Dedicated High-Speed Gen4 NVMe |
| OS | Ubuntu Server 24.04 LTS | Ubuntu 24.04 LTS / Pop!_OS (Driver 550+) |
Step 1: Directory Setup & Host Model Paths
Organize model weights outside the container so you never lose downloaded checkpoints when updating images:
sudo mkdir -p /opt/comfyui/{models/checkpoints,models/loras,models/vae,models/clip,custom_nodes,output,input} && \
cd /opt/comfyui && \
sudo chown -R $USER:$USER /opt/comfyui
Step 2: Production-Grade docker compose.yaml
Save the following file as /opt/comfyui/compose.yaml (following modern Compose Spec V2 without version:):
services:
comfyui:
image: yanwk/comfyui-boot:cu124
container_name: comfyui
restart: unless-stopped
ports:
- "127.0.0.1:8188:8188"
environment:
- CLI_ARGS=--listen 0.0.0.0 --port 8188 --preview-method auto
volumes:
- /opt/comfyui/models:/root/ComfyUI/models
- /opt/comfyui/custom_nodes:/root/ComfyUI/custom_nodes
- /opt/comfyui/output:/root/ComfyUI/output
- /opt/comfyui/input:/root/ComfyUI/input
networks:
- ai-network
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
networks:
ai-network:
name: ai-network
driver: bridge
Start the container:
cd /opt/comfyui && docker compose up -d
Verify GPU visibility inside the runtime:
docker exec -it comfyui nvidia-smi
Step 3: Downloading Base Models & Workflows
Download a base SDXL model directly into your checkpoints folder:
cd /opt/comfyui/models/checkpoints && \
curl -L -O https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors
Install the essential ComfyUI-Manager to enable one-click custom node updates:
cd /opt/comfyui/custom_nodes && \
git clone https://github.com/ltdrdata/ComfyUI-Manager.git && \
docker compose restart comfyui
Access the interface at http://YOUR_SERVER_IP:8188 (or via reverse proxy).
Step 4: Reverse Proxy & Security
Never expose ComfyUI directly to the internet without authentication, as arbitrary custom Python nodes can execute arbitrary system code.
In Nginx Proxy Manager:
- Forward
comfy.yourhomelab.nettohttp://127.0.0.1:8188. - Enable Websockets Support.
- Under Access List, configure HTTP Basic Authentication or restrict access to your home subnet / Tailscale IP range.
Step 5: Remote Generation with Tailscale
Connect your mobile device or remote laptop to your Tailscale network and point your browser to http://100.x.y.z:8188. You can initiate complex image generation workflows from your phone while your homelab GPU handles the heavy tensor computations at home.
Step 6: Automated Workflow & Node Backup
Create /opt/comfyui/backup.sh:
#!/usr/bin/env bash
set -euo pipefail
BACKUP_DIR="/mnt/backups/comfyui"
DATE=$(date +"%Y%m%d_%H%M%S")
mkdir -p "\${BACKUP_DIR}"
# Backup custom node configurations and generated images metadata
tar -czf "\${BACKUP_DIR}/comfyui_config_\${DATE}.tar.gz" -C /opt/comfyui custom_nodes compose.yaml
find "\${BACKUP_DIR}" -type f -name "*.tar.gz" -mtime +14 -delete
echo "[✓] ComfyUI configuration backup completed."
Schedule weekly backups:
chmod +x /opt/comfyui/backup.sh && \
(crontab -l 2>/dev/null; echo "0 5 * * 0 /opt/comfyui/backup.sh >> /var/log/comfy-backup.log 2>&1") | crontab -
Step 7: Deep Troubleshooting Matrix
| Error / Symptom | Root Cause | Verified Resolution |
|---|---|---|
Torch not compiled with CUDA enabled |
Container using CPU image or NVIDIA runtime missing. | Ensure image tag has CUDA suffix (cu124) and deploy.resources.reservations specifies GPU driver in compose file. |
CUDA out of memory during KSampler |
High batch size or attempting to render above GPU VRAM limit. | Add --lowvram or --medvram to CLI_ARGS environment variable in compose.yaml. |
| Custom nodes fail to load with Python import errors | Missing Python dependencies in container. | Open terminal in container: docker exec -it comfyui bash and run pip install -r /root/ComfyUI/custom_nodes/<node_folder>/requirements.txt. |
| Web UI disconnects during generation | WebSocket timeout in reverse proxy. | Add proxy_read_timeout 600s; and ensure WebSocket upgrades are enabled in Nginx Proxy Manager. |
| Models downloaded do not appear in dropdown | Downloaded into wrong subdirectory or file permission issue. | Checkpoints must reside in /models/checkpoints. Run sudo chmod 644 /opt/comfyui/models/checkpoints/*. |
Step 8: Frequently Asked Questions (FAQ)
1. How does ComfyUI save workflows?
ComfyUI automatically embeds the entire visual node graph metadata into the metadata chunk of every generated PNG file. Dragging any generated image back into the web browser instantly restores the exact workflow, prompt, and seed.
2. Can I use AMD Radeon GPUs?
Yes. Substitute the NVIDIA image with the ROCm image (yanwk/comfyui-boot:rocm6.1) and pass /dev/kfd and /dev/dri devices in your compose file.
3. Where should I store LoRA weights?
Place all .safetensors LoRA files inside /opt/comfyui/models/loras/. They will immediately appear in the Load LoRA node dropdown without restarting.
4. What is the difference between SDXL and Flux.1?
SDXL is optimized for fast, photorealistic 1024x1024 generation requiring 8-12 GB VRAM. Flux.1 is a 12B parameter flow-matching model with state-of-the-art prompt fidelity and text rendering, requiring 16-24 GB VRAM.
5. How can I queue multiple renders remotely?
Use ComfyUI's queue feature or send API requests directly to its REST endpoint (/prompt). Workflows can be automated via Python scripts or Home Assistant webhooks.
Was this homelab guide valuable to you?
Let us know if this worked on your setup or needs troubleshooting updates.
Play5afe Editorial Team
Technical DocumentationPractical documentation, tested configurations, and reference architectures for Linux, Docker, and self-hosted environments.
Reader Questions & Suggestions
0 Community FeedbackHave a question, feedback, or a configuration improvement for this guide? Leave a comment below or suggest a correction.
No comments yet for this guide.
Have a question or a configuration improvement? Leave a comment above or suggest a correction.