
ComfyUI is an open-source node-based interface for Stable Diffusion that enables complex image generation workflows. It provides a visual graph editor where users connect nodes to build custom pipelines for text-to-image, image-to-image, and inpainting tasks. ComfyUI supports advanced features like ControlNet, LoRA models, and custom sampling methods while offering efficient memory management for generating high-resolution images.
In this article, you will deploy ComfyUI using Docker Compose, configure persistent storage for models and outputs, and set up Traefik as a reverse proxy to securely access your ComfyUI instance.
Before you begin, you need to:
sudo privileges.comfyui.example.com).In this section, you prepare the required directory structure for ComfyUI and define environment variables in a .env file.
Create the directory structure for ComfyUI.
These directories store different types of data:
Navigate into the comfyui directory.
Create a .env file.
Add the following variables:
Replace:
comfyui.example.com with your domain.admin@example.com with your email.Save and close the file.
In this section, you create and deploy the Docker Compose stack that runs ComfyUI behind Traefik. Docker Compose manages both containers, applies the environment variables from your .env file, and automatically configures HTTPS routing through Traefik.
Create a new Docker Compose manifest.
Add the following content.
Save and close the file.
This manifest establishes:
CLI_ARGS=--listen --cpu configures ComfyUI to accept connections from Traefik and forces CPU-only inference mode../storage, ./models, ./output, ./input) preserve application data, model files, and generated images across restarts.letsencrypt retains certificate data through service updates.Create and start the services.
Verify that the services are running.
Output:
Both containers are operational. ComfyUI processes image generation requests while Traefik manages connections on ports 80 and 443.
View the logs of the services.
For more information on managing a Docker Compose stack, see the How To Use Docker Compose article.
This section shows how to access the ComfyUI interface and configure models for image generation workflows.
Open the ComfyUI interface in your browser.
The node-based workflow editor displays with a default text-to-image workflow. Explore the main interface components:
To generate images, download Stable Diffusion model files (.safetensors or .ckpt) from sources like Civitai or Hugging Face and place them in the ~/comfyui/models/checkpoints directory.
Build workflows by right-clicking the canvas to add nodes, then connect them by dragging from output to input sockets. Click Run to execute the workflow.
You have successfully deployed ComfyUI for AI image generation with HTTPS encryption. The Docker Compose configuration unites the Stable Diffusion interface with automated SSL management, while persistent volumes maintain your model library and generated artwork. Traefik handles certificate provisioning and secure request routing. Your ComfyUI instance is ready to execute complex generation workflows, experiment with various models and techniques, and produce high-quality AI-generated images through its intuitive node-based editor.
0 Comments
Be the first to comment and share your perspective with the community.