mmartial/ComfyUI-Nvidia-Docker

ComfyUI for NVIDIA GPU in a Docker container with user configurable uid/gid

What it solves

Running ComfyUI, a tool for creating images with AI, often means dealing with conflicting Python packages, CUDA versions, and permission issues. This project packages ComfyUI into a Docker container so it runs isolated from your host system, works cleanly on NVIDIA GPUs, and lets you run multiple setups side by side without breaking anything.

How it works

The container is built on official NVIDIA CUDA base images (Ubuntu + CUDA). When you start it, it creates two folders: a run folder for the ComfyUI source code and a Python virtual environment, and a basedir folder for your models, input files, output images, custom nodes, and other user data. The container drops root privileges and runs as a regular user (the comfy user), with your chosen UID and GID passed at launch so file permissions stay consistent. On first launch, it downloads ComfyUI from git, sets up a virtual environment, and installs ComfyUI Manager. Many options are controlled via environment variables: USE_UV to speed up package installation, TORCH_LOCK to pin PyTorch versions, SECURITY_LEVEL to control ComfyUI Manager's security, and more. The project provides pre‑built images for different Ubuntu and CUDA combinations, including versions for older GPUs (like GTX 10xx) and the latest Blackwell (RTX 50xx) hardware.

Who it's for

This is for anyone who wants to run ComfyUI on an NVIDIA GPU inside a container—especially if you need multiple isolated setups, want to avoid affecting your host OS, or work with GPUs that require specific CUDA versions. It's also handy for Unraid users and those comfortable with Docker or Podman.

Highlights

  • Containerized isolation for ComfyUI and its dependencies
  • Supports a wide range of Ubuntu + CUDA combinations, including GTX 10xx and Blackwell (RTX 50xx) GPUs
  • Separate run and basedir folders: one for code and environment, another for user data and models
  • Runs as a non‑root user with custom UID/GID mapping to preserve file ownership
  • Integrated ComfyUI Manager for easy updates and security level control
  • Command‑line overrides via environment variables and custom user scripts
  • Pre‑built images on DockerHub and for Unraid
  • Open‑source: build your own image using the provided Dockerfiles and scripts

Related

  • Project
  • Project
  • Project
  • Project
  • Project