2.7 KiB
Docker Compose
This repository includes a docker-compose.yml file to simplify running ComfyUI with Docker.
Docker Volumes vs. Local Directories
By default, the docker-compose.yml file uses a Docker-managed volume named workspace_data. This volume stores all of ComfyUI's data, including models, inputs, and outputs. This is the most straightforward way to get started, but it can be less convenient if you want to manage these files directly from your host machine.
For more direct control, you can configure Docker Compose to use local directories (bind mounts) instead. This maps folders on your host machine directly into the container.
To switch to using local directories, edit docker-compose.yml:
-
In both the
backendandfrontendservices, replace- workspace_data:/workspacewith the specific local directories you want to mount. For example:services: backend: volumes: # - workspace_data:/workspace # Comment out or remove this line - ./models:/workspace/models - ./custom_nodes:/workspace/custom_nodes - ./output:/workspace/output - ./input:/workspace/input ... frontend: volumes: # - workspace_data:/workspace # Comment out or remove this line - ./models:/workspace/models - ./custom_nodes:/workspace/custom_nodes - ./output:/workspace/output - ./input:/workspace/input -
At the bottom of the file, remove or comment out the
workspace_data: {}definition undervolumes.volumes: # workspace_data: {} # Comment out or remove this lineBefore running
docker compose up, make sure the local directories (./models,./custom_nodes, etc.) exist in the same directory as yourdocker-compose.ymlfile.
The example docker-compose file contains other configuration settings. You can also use bind-mount volumes in the volumes key of the whole compose file. Read it carefully.
Running with Docker Compose
Linux
Before you begin, you must have the NVIDIA Container Toolkit for Docker installed to enable GPU acceleration.
Starting the Stack
docker compose up
Containers
On NVIDIA:
docker pull ghcr.io/hiddenswitch/comfyui:latest
To run:
Windows, cmd
docker run -p "8188:8188" -v %cd%:/workspace -w "/workspace" --rm -it --gpus=all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 ghcr.io/hiddenswitch/comfyui:latest
Linux:
docker run -p "8188:8188" -v $(pwd):/workspace -w "/workspace" --rm -it --gpus=all --ipc=host ghcr.io/hiddenswitch/comfyui:latest