AIDockerGen AISelf-Hosting

ComfyUI with Docker: FLUX, SDXL and Wan Video on Your Own GPU (Linux, Windows, Mac)

Before you start

  • 19 min read

Boxes marked Run in terminal are what you type; plain text explains why. Check what you need first

What you get in one minute#

ComfyUI is a free, open-source, node-based engine that runs image and video AI models (SDXL, FLUX, Wan 2.2 and many more) on your own graphics card, with no cloud account.

You build a workflow by connecting boxes: load a model, write a prompt, sample, decode, save. The result is saved as a JSON file you can share and reload. People use it because it is fast on modest hardware (the project says even big models can run on as little as 4 GB of VRAM and 8 GB of RAM by streaming weights), because you keep full control of models and files, and because nothing leaves your computer unless you switch on the paid "partner" nodes.

In this guide you run ComfyUI in a Docker container on an NVIDIA GPU, keep every model and picture in one folder on your computer, and make your first SDXL, FLUX and Wan 2.2 results. Docker cannot use the Apple GPU on a Mac, so Mac users get a short native route instead.

WhatValue
Version usedComfyUI v0.42.1 (released 2026-10-19)
Docker imagelocal/comfyui:v0.42.1-cu130, built by you from the official release tag
Official Docker image?No. ComfyUI does not publish one; any image you find online is community-made
Time neededAbout 30 minutes, plus model downloads (10 to 40 GB)
Port8188 (web page), bound to your own computer only
Official docsdocs.comfy.org and the ComfyUI README

Why v0.42.1 and not an older release? We checked the issue tracker, the release list and Reddit on 2026-10-26. v0.42.1 only fixes crashes some people saw in v0.42.0. The one open regression we found (issue 17327) is about Ascend NPU cards, not NVIDIA, AMD or Apple. We found no repeated install failures or data loss, so the latest release is the pick. It is still only "no big complaints found", not a guarantee, so test your own workflows before you update later.

An older DIY Lab Hub guide installs ComfyUI without Docker on Ubuntu: Complete Guide to Installing and Configuring ComfyUI on Ubuntu. This new guide is the Docker, FLUX and Wan version.

How it fits together#

Your browser talks to ComfyUI on port 8188, ComfyUI runs on the GPU inside the container, and everything it reads or writes lives in one folder on your computer.

How ComfyUI runs in Docker: your browser connects to ComfyUI on port 8188 inside a locally built container; the container uses the NVIDIA GPU and bind-mounts one data folder on your computer holding models, input, output and user files; an optional Traefik proxy adds HTTPS on a server; on a Mac, Docker has no Apple GPU so ComfyUI runs natively

The container is disposable. The folder ~/docker_volumes/comfyui/data is the part you back up.

Before you start#

You need an NVIDIA GPU with a current driver, Docker, and enough disk space for models.

SystemWhat you needGPU in Docker
LinuxDocker Engine with Compose v2, NVIDIA driver, NVIDIA Container ToolkitNVIDIA works. AMD: use the native install (docs, ROCm 7.2), not this recipe
WindowsWindows 11, current NVIDIA driver, Docker Desktop with the WSL2 backendNVIDIA works through WSL2 (Docker Desktop GPU support)
MacApple Silicon (M1 or newer), macOS 13 or newer, Python 3.13No Docker GPU. Use the native route below

Other numbers to know:

  • Disk: 50 GB free is a sensible start. One FLUX checkpoint is about 17 GB and the Wan 2.2 5B set is about 18 GB.
  • RAM: 16 GB works for small jobs. We suggest 32 GB or more for FLUX and video (a planning tip, not an official minimum).
  • NVIDIA 20-series and newer need PyTorch built for CUDA 13.0 (cu130) or newer, according to the README. Older cards (10-series and below) are not covered by this recipe.
  • On plain Windows the desktop app or the portable build is easier. This guide uses Docker because a container is easy to rebuild.

Check your tools:

Run in terminalbash
docker --version
docker compose version
nvidia-smi
  • [ ] Docker runs and docker compose version works
  • [ ] nvidia-smi shows your GPU (Linux or Windows)
  • [ ] Port 8188 is free
  • [ ] You have 50 GB of free disk space

Tested on 2026-10-26: not run by DIY Lab Hub. Every command was checked against the official docs and release files (README for v0.42.1, docs.comfy.org). The Dockerfile and Compose file are our own recipe, because there is no official one, so treat the first start as the test.

Step 1: Check that Docker can see your GPU#

Run NVIDIA's own test container; if it prints your GPU, the rest will work.

Linux#

Run in terminalbash
docker run --rm --gpus all ubuntu nvidia-smi

If this fails, install the NVIDIA Container Toolkit first (link in the table above) and restart Docker.

Windows (PowerShell)#

Run in terminalpowershell
docker run --rm --gpus all ubuntu nvidia-smi

Docker Desktop must use the WSL2 backend. Do not install a Linux GPU driver inside WSL; the Windows driver is shared.

Mac (Terminal)#

Skip this step. Docker on a Mac has no Apple GPU access, so go to Step 2 and use the native route.

Check it worked: you see the same GPU table you see on the host.

Step 2: Create the folders and the two files#

Make one folder tree under ~/docker_volumes/comfyui, then save a Dockerfile and a Compose file.

The Dockerfile builds ComfyUI from the official v0.42.1 tag. The pip line comes from the current README. The Debian packages, the non-root user and the folder layout are our choices. --base-directory /data is a real ComfyUI flag that puts models, input, output, user files and the temp folder under one path, which is exactly what we want to mount.

Linux#

Run in terminalbash
mkdir -p ~/docker_volumes/comfyui/data/{models/{checkpoints,diffusion_models,text_encoders,vae,loras},input,output,user,custom_nodes} ~/docker_volumes/comfyui/backups
cd ~/docker_volumes/comfyui
printf 'LOCAL_UID=%s\nLOCAL_GID=%s\n' "$(id -u)" "$(id -g)" > .env

cat > Dockerfile <<'EOF'
FROM python:3.13-slim-bookworm

ARG COMFYUI_VERSION=v0.42.1

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    HOME=/tmp

RUN apt-get update && apt-get install -y --no-install-recommends \
      git ca-certificates libgomp1 libgl1 libglib2.0-0 ffmpeg \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /opt
RUN git clone --branch "${COMFYUI_VERSION}" --depth 1 \
      https://github.com/comfyanonymous/ComfyUI.git ComfyUI

WORKDIR /opt/ComfyUI
RUN python -m pip install --upgrade pip \
    && python -m pip install torch torchvision torchaudio \
         --extra-index-url https://download.pytorch.org/whl/cu130 \
    && python -m pip install -r requirements.txt \
    && python -m pip freeze > /opt/python-environment.txt

EXPOSE 8188
ENTRYPOINT ["python", "main.py"]
CMD ["--listen", "0.0.0.0", "--port", "8188", "--base-directory", "/data", "--offline"]
EOF

cat > docker-compose.yml <<'EOF'
services:
  comfyui:
    image: local/comfyui:v0.42.1-cu130
    build:
      context: .
      args:
        COMFYUI_VERSION: v0.42.1
    container_name: comfyui
    restart: unless-stopped
    init: true
    user: "${LOCAL_UID:-1000}:${LOCAL_GID:-1000}"
    ports:
      - "127.0.0.1:8188:8188"
    volumes:
      - ./data:/data
    shm_size: "1gb"
    security_opt:
      - no-new-privileges:true
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    healthcheck:
      test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8188/', timeout=5)"]
      interval: 30s
      timeout: 10s
      start_period: 120s
      retries: 3
EOF

Windows (PowerShell)#

Codepowershell
$Root = "$HOME\docker_volumes\comfyui"
foreach ($d in 'checkpoints','diffusion_models','text_encoders','vae','loras') { New-Item -ItemType Directory -Force "$Root\data\models\$d" | Out-Null }
foreach ($d in 'input','output','user','custom_nodes') { New-Item -ItemType Directory -Force "$Root\data\$d" | Out-Null }
New-Item -ItemType Directory -Force "$Root\backups" | Out-Null
Set-Location $Root

@'
FROM python:3.13-slim-bookworm

ARG COMFYUI_VERSION=v0.42.1

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    HOME=/tmp

RUN apt-get update && apt-get install -y --no-install-recommends \
      git ca-certificates libgomp1 libgl1 libglib2.0-0 ffmpeg \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /opt
RUN git clone --branch "${COMFYUI_VERSION}" --depth 1 \
      https://github.com/comfyanonymous/ComfyUI.git ComfyUI

WORKDIR /opt/ComfyUI
RUN python -m pip install --upgrade pip \
    && python -m pip install torch torchvision torchaudio \
         --extra-index-url https://download.pytorch.org/whl/cu130 \
    && python -m pip install -r requirements.txt \
    && python -m pip freeze > /opt/python-environment.txt

EXPOSE 8188
ENTRYPOINT ["python", "main.py"]
CMD ["--listen", "0.0.0.0", "--port", "8188", "--base-directory", "/data", "--offline"]
'@ | Set-Content -Encoding utf8 Dockerfile

@'
services:
  comfyui:
    image: local/comfyui:v0.42.1-cu130
    build:
      context: .
      args:
        COMFYUI_VERSION: v0.42.1
    container_name: comfyui
    restart: unless-stopped
    init: true
    ports:
      - "127.0.0.1:8188:8188"
    volumes:
      - ./data:/data
    shm_size: "1gb"
    security_opt:
      - no-new-privileges:true
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    healthcheck:
      test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8188/', timeout=5)"]
      interval: 30s
      timeout: 10s
      start_period: 120s
      retries: 3
'@ | Set-Content -Encoding utf8 docker-compose.yml

On Windows the folder sits on the Windows disk and Docker Desktop shares it with the container. That works but reads big model files more slowly than a folder inside WSL2. If speed matters, open a WSL2 Ubuntu shell and follow the Linux commands there instead.

Mac (Terminal)#

No Docker here. Install ComfyUI natively with a virtual environment. The README says to install a PyTorch nightly build for Apple Silicon, following Apple's page, then install the requirements.

Run in terminalbash
mkdir -p ~/docker_volumes/comfyui/data && cd ~/docker_volumes/comfyui
git clone --branch v0.42.1 --depth 1 https://github.com/comfyanonymous/ComfyUI.git source
cd source
python3.13 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu
python -m pip install -r requirements.txt
python -c "import torch; print('Metal (MPS) available:', torch.backends.mps.is_available())"

VERIFY: the nightly index URL above is the one Apple's Accelerated PyTorch on Mac page shows; check that page for the current line, because nightly builds change. If you want the easy way, the official Desktop app for macOS needs no terminal at all.

Check it worked: Linux and Windows show the three files with ls or dir; on Mac the last command prints Metal (MPS) available: True.

Step 3: Build and start ComfyUI#

Build the image once, then start the container in the background.

The first build downloads PyTorch with CUDA: several minutes and a few GB.

Linux#

Run in terminalbash
cd ~/docker_volumes/comfyui
docker compose config
docker compose build --pull
docker compose up -d
docker compose logs -f comfyui

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\comfyui"
docker compose config
docker compose build --pull
docker compose up -d
docker compose logs -f comfyui

Mac (Terminal)#

Run in terminalbash
cd ~/docker_volumes/comfyui/source
source .venv/bin/activate
python main.py --base-directory "$HOME/docker_volumes/comfyui/data" --offline

Leave this window open; Ctrl+C stops it.

Check it worked: the log ends with a line saying the server is available, and docker compose ps (Linux, Windows) shows the container as running (later healthy). Open http://127.0.0.1:8188 in your browser.

Step 4: Prove the GPU is really used#

A working web page does not prove the GPU works, so ask PyTorch directly.

Linux#

Run in terminalbash
docker compose exec comfyui python -c 'import torch; print(torch.__version__); print("CUDA:", torch.cuda.is_available()); print(torch.cuda.get_device_name(0) if torch.cuda.is_available() else "NO GPU")'

Windows (PowerShell)#

Run in terminalpowershell
docker compose exec comfyui python -c "import torch; print(torch.__version__, torch.cuda.is_available())"

Expect the PyTorch version followed by True.

Mac (Terminal)#

You already ran the Metal check in Step 2. Same result expected: True.

Check it worked: CUDA: True and your GPU name (Windows: True). If you see NO GPU, jump to the Troubleshooting table.

Step 5: Put models in the right folders#

Download models on your computer, not inside the container, and drop them into data/models/<type>.

ComfyUI looks for each model type in its own folder. These are the ones this guide uses:

Folder under data/models/What goes there
checkpoints/All-in-one files: an SDXL checkpoint, or the single-file FLUX FP8 checkpoint
diffusion_models/Separate diffusion weights (FLUX full weights, Wan 2.2)
text_encoders/Text encoders (for example umt5_xxl_fp8_e4m3fn_scaled.safetensors for Wan)
vae/Image decoders (wan2.2_vae.safetensors, ae.safetensors for FLUX)
loras/Small style add-ons

Model families do not mix: FLUX needs FLUX parts, not an SDXL VAE.

Wan 2.2 text-to-video (the 5B model). These are the files named by the official Wan 2.2 tutorial, from the Comfy-Org repackaged repository on Hugging Face (about 10.0 GB, 6.7 GB and 1.4 GB). The ComfyUI docs say this workflow should fit in 8 GB of VRAM thanks to native offloading.

Linux#

Run in terminalbash
cd ~/docker_volumes/comfyui/data/models
B=https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files
curl -L -C - -o diffusion_models/wan2.2_ti2v_5B_fp16.safetensors "$B/diffusion_models/wan2.2_ti2v_5B_fp16.safetensors"
curl -L -C - -o text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors "$B/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors"
curl -L -C - -o vae/wan2.2_vae.safetensors "$B/vae/wan2.2_vae.safetensors"

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\comfyui\data\models"
$B = 'https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files'
curl.exe -L -C - -o diffusion_models\wan2.2_ti2v_5B_fp16.safetensors "$B/diffusion_models/wan2.2_ti2v_5B_fp16.safetensors"
curl.exe -L -C - -o text_encoders\umt5_xxl_fp8_e4m3fn_scaled.safetensors "$B/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors"
curl.exe -L -C - -o vae\wan2.2_vae.safetensors "$B/vae/wan2.2_vae.safetensors"

Mac (Terminal)#

Same commands as Linux, with this folder first:

Run in terminalbash
cd ~/docker_volumes/comfyui/data/models

FLUX.1 schnell, single file. The official FLUX tutorial offers a one-file FP8 checkpoint for lower memory, with a possible small quality loss. It is about 17 GB and sits in checkpoints/. The model is listed under Apache-2.0 on its Hugging Face page, but read the licence there before commercial use. FLUX.1 dev has different terms.

Run in terminalbash
curl -L -C - -o checkpoints/flux1-schnell-fp8.safetensors https://huggingface.co/Comfy-Org/flux1-schnell/resolve/main/flux1-schnell-fp8.safetensors

On Windows use curl.exe -L -C - -o checkpoints\flux1-schnell-fp8.safetensors <same URL>.

SDXL. Download an SDXL checkpoint from a model page whose licence you have read, and place it in checkpoints/. We do not name one here, because we did not verify a current official download; pick one yourself.

Check it worked: refresh the ComfyUI page (press r); the files show up in the model dropdowns. If a dropdown says null, the file is in the wrong folder.

Step 6: Run your first workflow#

Use a built-in template, because it already has the right nodes and file names.

Open the template browser (Workflow menu, Browse Templates), pick the template for your model (an SDXL one, FLUX.1, or "Wan2.2 5B"), check that each loader shows the file you downloaded, keep batch size at 1 and press Run. For Wan, start with the template's own settings and a short clip.

Linux#

Run in terminalbash
xdg-open http://127.0.0.1:8188
ls ~/docker_volumes/comfyui/data/output

Windows (PowerShell)#

Codepowershell
Start-Process http://127.0.0.1:8188
dir "$HOME\docker_volumes\comfyui\data\output"

Mac (Terminal)#

Run in terminalbash
open http://127.0.0.1:8188
ls ~/docker_volumes/comfyui/data/output

Check it worked: your picture or clip appears in output/. Saved workflows (Ctrl+S) go to data/user/. If you run the same graph twice unchanged, ComfyUI skips the finished work, so change the seed when you want to measure speed.

Low VRAM and flags that matter now#

Start with no flags; ComfyUI manages VRAM itself, and old tips can now do nothing.

The current startup reference says dynamic VRAM and asynchronous offloading are on automatically where supported. In that mode --lowvram does nothing. Without it, --lowvram runs text encoders on the CPU.

FlagUse it when
--reserve-vram 1Your desktop or another app needs about 1 GB left over
--lowvramYou still run out of memory and dynamic VRAM is not active
--novram--lowvram is not enough
--cpuLast resort; very slow

--gpu-only, --highvram, --lowvram, --novram and --cpu exclude each other: pick one. To add flags in Docker, add them to the end of the command: of the service (it replaces the default, so repeat the defaults):

File contentyaml
    command: ["--listen", "0.0.0.0", "--port", "8188", "--base-directory", "/data", "--offline", "--reserve-vram", "1"]

What each model asks for (official statements only; peak memory also depends on resolution, batch size and video length):

ModelWhat the docs say
Any big modelREADME: runs on as little as 4 GB VRAM with 8 GB RAM using weight streaming (slower)
FLUX.1 FP8 single fileLower-memory route in the official tutorial; full separate weights need more
Wan 2.2 TI2V 5BOfficial tutorial: fits in 8 GB VRAM with native offloading
Wan 2.2 A14BNo single floor published; follow the template's high-noise and low-noise files
SDXLSupported natively; no fixed number in the docs. Start at batch size 1

Custom nodes and ComfyUI-Manager: be careful#

A custom node is code that runs on your computer with your permissions, so install as few as possible.

ComfyUI-Manager is built in now. You switch it on with --enable-manager; the old way of cloning it into custom_nodes is outdated. This guide leaves it off. The container user cannot install Python packages into the image, which blocks the easy path for bad code, and it keeps your setup reproducible.

Real incidents show why. Manager's own security check knows about the malicious ComfyUI_LLMVISION node, the lolMiner crypto-miner files, and the compromised ultralytics versions 8.3.41 and 8.3.42 (see the ComfyUI statement). Being listed in Manager does not mean a node is safe.

If you need a node:

  1. Read its repository, its requirements.txt and any install script first.
  2. Copy it into data/custom_nodes/ on the host.
  3. Add its dependencies as a RUN python -m pip install ... line in the Dockerfile and rebuild.
  4. Never mount your SSH folder, browser profile, cloud credentials or the Docker socket into this container.

If you ever ran a bad node, deleting it is not enough. Rebuild from a clean image and change any password or key that the container could reach.

Put it behind HTTPS with Traefik#

Only do this on a server with a domain; for a home computer, skip this section.

Add these labels and the network to the same service. Create the shared network once with docker network create proxy if you do not have it. Remove the ports: block when Traefik is the only way in. ComfyUI has no login of its own, so protect the router with an authentication middleware (shown as my-auth@file, which you must create yourself).

File contentyaml
services:
  comfyui:
    networks:
      - proxy
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.comfyui.rule=Host(`comfyui.example.com`)"
      - "traefik.http.routers.comfyui.entrypoints=https"
      - "traefik.http.routers.comfyui.tls=true"
      - "traefik.http.routers.comfyui.middlewares=my-auth@file"
      - "traefik.http.services.comfyui.loadbalancer.server.port=8188"

networks:
  proxy:
    external: true

Merge this into your existing file; do not create a second services: block. Your Traefik entry point may be called websecure instead of https: use the name from your own Traefik setup.

Security and testing#

Keep ComfyUI off the public internet; HTTPS hides traffic but does not make custom nodes safe.

  • The Compose file publishes the port only on 127.0.0.1. That means only your own computer can reach it. Do not change it to 0.0.0.0 or open the port in your router.
  • --offline turns off the paid partner (API) nodes and keeps the frontend from reaching the internet. If the template browser looks incomplete, remove that flag and try again.
  • Local FLUX, SDXL and Wan need no API keys. Do not put a Hugging Face token into the Dockerfile or Compose file; download gated models on the host.
  • If you use a .env file for anything secret, run chmod 600 .env (Linux, Mac).

Quick tests:

Run in terminalbash
docker compose ps
docker compose logs --tail 50 comfyui
curl -I http://127.0.0.1:8188/

On Windows use Invoke-WebRequest -Method Head http://127.0.0.1:8188/. On Traefik, test with curl -I https://comfyui.example.com/.

Acceptance check before you call it done:

  • [ ] CUDA: True in Step 4
  • [ ] One SDXL image, one FLUX image and one short Wan clip finish
  • [ ] Outputs are still in data/output/ after docker compose restart
  • [ ] An exported workflow loads again

Troubleshooting#

ProblemSolution
Torch not compiled with CUDA enabledWrong PyTorch build. Native install: pip uninstall torch, then install the cu130 command from this guide. Docker: rebuild the image, do not patch the running container
RuntimeError: CUDA out of memoryLower batch size, image size or video length, use the FP8 FLUX file, or try --reserve-vram 1
could not select device driver "" with capabilities: [[gpu]]NVIDIA Container Toolkit missing (Linux). Install it, run sudo nvidia-ctk runtime configure --runtime=docker, restart Docker
CUDA: False inside the containerRun Step 1 again. On Windows check Docker Desktop uses WSL2 and the Windows NVIDIA driver is current
Model dropdown shows nullThe file is missing or in the wrong folder. Use the table in Step 5, then press r in the page
mat1 and mat2 shapes cannot be multiplied (154x2048 and 768x320)You mixed model families (for example an SDXL checkpoint with an SD1.5 text encoder or a FLUX VAE). Use the template for your model
Permission denied on data/The folder owner differs from the container user. Linux: check .env has your IDs, or sudo chown -R "$(id -u):$(id -g)" data
Malware has been detected, forcibly terminating ComfyUI execution.Manager's security check found a known bad node, package or file. Stop, rebuild clean, rotate keys. Do not turn the check off
Page loads but is empty on a Traefik nameWrong entry point name or network. Check docker compose logs and your router labels

Diagnostic commands:

Run in terminalbash
docker compose ps
docker logs comfyui --tail 100
docker inspect comfyui --format '{{.State.Health.Status}}'

Known bugs: at the time of writing, an open regression (issue 17327) breaks model loading on Ascend NPU hardware in v0.42.1. It does not touch NVIDIA, AMD or Apple. Check the issue before you pick v0.42.1 on Ascend.

Updates and backups#

Update by building a new tagged image next to the old one, and back up data/ first.

ComfyUI releases roughly every week or two, and a pin on the ComfyUI tag does not freeze Python packages or the base image. So keep the old image until the new one passes your tests.

Linux#

Run in terminalbash
cd ~/docker_volumes/comfyui
stamp="$(date +%Y%m%d-%H%M%S)"
docker compose stop
tar -czf "backups/data-$stamp.tar.gz" --exclude='data/models' data Dockerfile docker-compose.yml .env
docker save local/comfyui:v0.42.1-cu130 | gzip > "backups/image-$stamp.tar.gz"
docker compose start

To update, change v0.42.1 to the new tag in three places (the image: line, the build argument in the Compose file and the ARG default), then run docker compose build && docker compose up -d and repeat the acceptance check. Models are excluded from the archive on purpose: keep a list of where you got them instead.

Schedule it with cron at 03:00 (crontab -e) by putting the commands above into a script:

File contenttext
0 3 * * * /home/<you>/docker_volumes/comfyui/backup.sh

Windows (PowerShell)#

Codepowershell
Set-Location "$HOME\docker_volumes\comfyui"
$stamp = Get-Date -Format 'yyyyMMdd-HHmmss'
docker compose stop
tar -czf "backups\data-$stamp.tar.gz" --exclude=data/models data Dockerfile docker-compose.yml
docker compose start

Windows 11 includes tar. Put the commands in a .ps1 file and run it with Task Scheduler at 03:00.

Mac (Terminal)#

Run in terminalbash
cd ~/docker_volumes/comfyui
stamp="$(date +%Y%m%d-%H%M%S)"
mkdir -p backups
tar -czf "backups/data-$stamp.tar.gz" --exclude='data/models' data

Schedule it with cron (crontab -e) at 03:00 like on Linux. To update the native install, run git fetch --tags and git checkout <new-tag> in source, then reinstall the requirements.

Restore test#

A backup you never restored is a guess. Restore into a separate folder, on another port:

Run in terminalbash
mkdir -p ~/docker_volumes/comfyui-restore-test && cd ~/docker_volumes/comfyui-restore-test
tar -xzf ~/docker_volumes/comfyui/backups/data-<stamp>.tar.gz
mkdir -p data/models
sed -i 's/127.0.0.1:8188:8188/127.0.0.1:8189:8188/; s/container_name: comfyui/container_name: comfyui-restore/; s/restart: unless-stopped/restart: "no"/' docker-compose.yml
docker compose -p comfyui-restore up -d --no-build

Open http://127.0.0.1:8189, load a saved workflow from the Workflow menu and check that it opens. Copy or link a model to test a real run. Then clean up:

Run in terminalbash
docker compose -p comfyui-restore down

The image is also in your backup: gzip -dc backups/image-<stamp>.tar.gz | docker load brings it back if you ever lose it.

Performance and resources#

Disk speed and VRAM matter more than anything else, and docker stats shows you the rest.

  • Watch the container: docker stats comfyui (RAM and CPU), nvidia-smi (VRAM).
  • Keep models on a fast local SSD.
  • Close other GPU-heavy programs for a fair test, and change the seed between runs.
  • Note model, resolution, batch size, steps and seed before comparing two versions. We measured no speed numbers, so we show none.

FAQ#

Is there an official ComfyUI Docker image? No. The project does not publish one, and the README does not mention Docker. That is why this guide builds its own image from the official release tag. Any image with "ComfyUI" in its name on Docker Hub is community-made; read its Dockerfile first.

Can an 8 GB graphics card make Wan videos? The official Wan 2.2 tutorial says the 5B text-and-image-to-video workflow should fit in 8 GB of VRAM with native offloading. Long clips, high resolutions and the larger 14B models need more.

Should I use Docker on an Apple Silicon Mac? No. A Linux container cannot use the Apple GPU. Use the Desktop app or the native route in this guide to get Metal acceleration.

Does ComfyUI-Manager make custom nodes safe? No. It installs nodes and checks for known bad ones, but a node is still code that runs on your machine. Install few, read them first and keep passwords and keys out of reach.

Sources#

Read on 2026-10-26. Newer official pages were preferred over older ones.

Checked against the official docs on 2026-10-26. Not run by DIY Lab Hub: the Dockerfile and Compose recipe is our own and is untested on real hardware.