Back when AI powered image generation was still in its early days, running these apps on bare metal was the only option. But I had a hunch that someone with the skills to make it happen would eventually create Docker images. Now, thanks to some amazingly talented folks, it's easier than ever to get started with Docker containers that can tap into GPUs for lightning-fast AI image generation or text to image using ComfyUI.
What is ComfyUI?
ComfyUI is a total dream come true for anyone who loves turning words into images. This free and open-source tool lets you create amazing images from text prompts, all through a bit more advanced interface that feels like a breath of fresh air.




While ComfyUI does take some getting used to, it really delivers in terms of sheer range. With 65,000 GitHub stars and over 3,000 commits under its belt, it's attracted an incredible community that's been working together to create all sorts of innovative custom nodes and workflows.
What you Need to Run ComfyUI in Docker
- A computer with Linux and Docker installed. I use Ubuntu but PopOS is a good one too if you need a good distro with a Desktop GUI.
- NVIDIA GPU with 6GB VRAM or more. I use a ASUS ROG STRIX GeForce RTX 2080TI-O11G Overclocked. Yeah, I know, it's a mouth full. The more VRAM the card has, the better. Mine has 11GB of VRAM.
- Latest NVIDIA GPU driver
- Either Game or Studio edition will work.
- You don’t need to install drivers inside containers. Just make sure it’s working on your host OS.
Install ComfyUI using Docker Compose
If you don't have Docker installed and need help getting started, I recommend checking out our self-hosting guides for beginners. These guides cover the basics of setting up Docker on your server. They're designed to help you get up and running smoothly, even if you're new to self-hosting. It's also good practice to use UID and PID but for the sake of this guide we are using root on a local machine that will NOT be exposed.
Use the following Docker Compose to install ComfyUI:
services:
comfyui-boot:
stdin_open: true
tty: true
container_name: comfyui-cu124
ports:
- 8288:8188
volumes:
- '/docker/ComfyUIdocker:/root'
image: yanwk/comfyui-boot:cu124-slim
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities:
- gpuThis ComfyUI Docker Compose gives ComfyUI access to use your NVIDIA GPU which is exactly what we want. This way our GPU can do all the heavy lifting. It tells the container to map files to the /docker/ComfyUIdocker where your models/checkpoints, loras and images can all be accessed.
Be sure to edit the mounted volume to where you prefer to have it mounted before deploying ComfyUI.
Downloading Models from CivitAI
Before we get started, I'd like to get you set up with a fantastic turbo model that'll speed up your image generation process dramatically! Head over to CivitAI and sign up for an account. Don't worry, it's free! Once you're in, download the DreamShaper XL Turbo v2.1 model. Just place model in the checkpoints folder we set up in our Docker Compose, that way, everything will be ready to go for our next step. It will be /ComfyUI/models/checkpoints.

ComfyUI Web UI Beginner Tour
When you visit the ComfyUI web interface for the first time it will look like this:

Or, you may notice the blue queue button element at the bottom of the canvas. It can be moved and snapped to the top if you prefer that like I do.
At its core, ComfyUI's workflow is built from two fundamental components: Nodes and Links.
Think of Nodes like self-contained blocks that perform specific tasks. Essentially, functions that take in some inputs, run some code, and produce outputs. If you've got programming experience, you might already be familiar with this idea!
Each Node requires three key elements:
- Inputs : The text prompts and data that flow into the Node from the edges.
- Outputs : The generated images or results that are sent out to the next Node in the workflow.
- Parameters : The settings and controls that allow you to customize how each Node works.
Links, meanwhile, connect Nodes together, allowing the outputs of one Node to become inputs for another. This creates a powerful pipeline for generating complex images from text prompts!
Now I'll give you the basic rundown on what ComfyUI settings to use with this model followed by a single screenshot with numbered steps. You may have to refresh the UI to see the new checkpoint we added. If you still don't see it, restart the Docker container.
- In the Load Checkpoint box, change it to dreamshaperXL_v21TurboDPMSDE.safetensors
- In the KSampler box, change the steps to 6, cfg to 3.0, sampler_name to dpmpp_sde and the scheduler to karras.
- In the Empty Latent Image box, change the size of the image to 1280 x 720 to start out. The larger the image size, the longer it will take to generate.
- In the CLIP Text Encode (Prompt) box, write a short prompt for an image you want to generate. Be creative! You can test it with the default prompt if you want or try this one:
Steampunk landscape with buildings and smoking chimneys made of copper. river flowing through with glowing lights. - Press the Queue button and generate your image!

With workflows, you're not stuck in one way of working forever. You can save your favorite configurations as 'live' templates, so when you need to pivot quickly, they're just a click away. This means you can go from A to B without having to redo everything. Check out this video to see mine in action.

No need to close one workflow and start another, they'll run independently in separate tabs, allowing you to zip between them seamlessly.
Organize and Prettify your ComfyUI Interface
Having a bunch of boxed (Nodes) all over the interface seems cluttered and can be a big part in making you feel overwhelmed. So to tidy things up a bit I am going to highlight every Node accept the "Save Image" Node and convert it to a group Node.

You can do this by holding Ctrl on your keyboard, selecting all the nodes but the "Save Image" node, then right click on one of the nodes and select "Convert to Group Node". I created a short video here showing how I do it and you can resize the new Node to your liking. It will look like this when you are done.

Notice that the refined design significantly reduces visual clutter, creating a more streamlined and uncluttered appearance that enhances the overall aesthetic of the interface. The newly simplified layout makes it feel more organized and easier on the eyes.
Stats for Nerds
ComfyUI sits idly by at only 566mb of VRAM or about half a gig and uses about ~4gb of VRAM when generating images.

Final Notes and Thoughts
This should be enough to get you going with ComfyUI in Docker. Trust me, you're going to love it, but be warned, once you start down this rabbit hole, it can be hard to look back.
If you're curious about connecting ComfyUI to Open WebUI to generate images too, I'm happy to walk you through it. And if you're new to image generation, I'd definitely recommend checking out our guide on Fooocus AI for an options that's a bit more user freindly.






Discussion