Skip to content

Commit 326b53e

Browse files
Updated the Dependencies of the Project
Updated the base image of the Dockerfile to the latest version of PyTorch (from PyTorch 2.8.0, CUDA 12.9, and cuDNN 9 to PyTorch 2.9.1, CUDA 13.0, and cuDNN 9), updated the ComfyUI version to the latest version (from ComfyUI 0.3.49 to ComfyUI 0.8.2), and updated the ComfyUI Manager version to the latest version (from ComfyUI Manager 3.35 to ComfyUI Manager 4.0.5). Also updated the GitHub Actions used in the build-and-publish workflow to the latest versions available. The name of the GitHub organization that maintains the ComfyUI project has changed from @comfyanonymous to @Comfy-Org, so I updated the GitHub repository URL used in the Dockerfile to clone the ComfyUI repository to use the new organization name. Furthermore, I went through the contributions of @alex-marinov made in the pull request #31: - Renamed the "docker-compose.yml" file to "compose.yml", which is now the standard name for Docker Compose files. - Removed some of the redundant comments in the Dockerfile, which were already incorporated in the read me. - Renamed the environment variables for the user ID and the group ID used in the Docker Compose file. - Added environment variables for the three volume directories used by ComfyUI Docker (for the models, custom nodes, and outputs) in the Docker Compose file. - Updated the changelog to include the changes made by @alex-marinov in the pull request #31. - Included @alex-marinov in the list of contributors in the "CONTRIBUTORS.md" file. - Edited the read me to improve the instructions on using the Docker Compose file and to make the information about creating the new output volume directory stand out more using a warning.
1 parent 4fe0c81 commit 326b53e

File tree

8 files changed

+154
-113
lines changed

8 files changed

+154
-113
lines changed

.cspell.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161

6262
// A list of words that are not in the included default dictionary for British English, American English, or German
6363
"words": [
64+
"comfyanonymous",
6465
"comfyui",
6566
"controlnet",
6667
"cudnn",
@@ -79,6 +80,7 @@
7980
"libglib",
8081
"libgthread",
8182
"loras",
83+
"Marinov",
8284
"photomaker",
8385
"PYTHONPATH",
8486
"pytorch",

.github/workflows/build-and-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ jobs:
3838

3939
# Checks out the repository so that the workflow can access the files in the repository
4040
- name: Checkout repository
41-
uses: actions/checkout@v4
41+
uses: actions/checkout@v6
4242

4343
# Installs Python, which is used to extract the version of ComfyUI and the ComfyUI Manager from the Dockerfile using a regular expression
4444
- name: Install Python
45-
uses: actions/setup-python@v5
45+
uses: actions/setup-python@v6
4646
with:
4747
python-version: '3.13'
4848

@@ -116,7 +116,7 @@ jobs:
116116
# Generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built; it increases supply chain
117117
# security for people who consume the image
118118
- name: Generate Artifact Attestation
119-
uses: actions/attest-build-provenance@v1
119+
uses: actions/attest-build-provenance@v3
120120
with:
121121
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
122122
subject-digest: ${{ steps.build-and-push-docker-image.outputs.digest }}

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## v0.6.0 (January 8, 2026)
4+
5+
- Updated the base image of the Dockerfile to the latest version of PyTorch (from PyTorch 2.8.0, CUDA 12.9, and cuDNN 9 to PyTorch 2.9.1, CUDA 13.0, and cuDNN 9).
6+
- Updated the ComfyUI version to the latest version (from ComfyUI 0.3.49 to ComfyUI 0.8.2).
7+
- Updated the ComfyUI Manager version to the latest version (from ComfyUI Manager 3.35 to ComfyUI Manager 4.0.5).
8+
- Updated the versions of the checkout action, Python setup action, and attest build provenance action in the GitHub Actions workflow to their latest versions.
9+
- The outputs of ComfyUI are now stored outside of the container in a directory on the host system. This prevents the loss of outputs when the container is removed. The read me was updated to reflect this change.
10+
- A Docker Compose file was added to the repository to make running, managing, and updating ComfyUI Docker easier. The read me was updated to include instructions on how to use Docker Compose.
11+
- This version of ComfyUI Docker was made possible by the contributions of [Alex Marinov](@alex-marinov).
12+
313
## v0.5.0 (August 12, 2025)
414

515
- The ComfyUI Manager repository has been moved to a new organization and therefore, the URL from which it can be cloned has changed. This URL was updated in the Dockerfile.

CONTRIBUTORS.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Contributors
22

3-
This file contains a list of contributors to the ComfyUI Docker project.
3+
The project was initially created and is maintained by [David Neumann](@lecode-official). The following people (in alphabetical order) have contributed in various ways to the development of ComfyUI Docker. Their contributions are greatly appreciated.
44

5-
- [Alex Reynolds](@primlock) (#22)
6-
- [Chris TenHarmsel](@epchris) (#13)
7-
- [David Neumann](@lecode-official) (#3, #4, #5, #10, #11, #12, #17, #18)
8-
- [Mustafa Hamade](@Mustafa-Hamade) (#20)
9-
- [Patrick Kranz](@LokiMidgard) (#21)
5+
- [Alex Marinov](@alex-marinov) ([#31](https://github.com/lecode-official/comfyui-docker/pull/31))
6+
- [Alex Reynolds](@primlock) ([#22](https://github.com/lecode-official/comfyui-docker/pull/22))
7+
- [Chris TenHarmsel](@epchris) ([#13](https://github.com/lecode-official/comfyui-docker/pull/13))
8+
- [Mustafa Hamade](@Mustafa-Hamade) ([#20](https://github.com/lecode-official/comfyui-docker/issues/20))
9+
- [Patrick Kranz](@LokiMidgard) ([#21](https://github.com/lecode-official/comfyui-docker/pull/21))

README.md

Lines changed: 104 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ This is a Docker image for [ComfyUI](https://www.comfy.org/), which makes it ext
44

55
## Getting Started
66

7-
To get started, you have to install [Docker](https://www.docker.com/). This can be either Docker Engine, which can be installed by following the [Docker Engine Installation Manual](https://docs.docker.com/engine/install/) or Docker Desktop, which can be installed by [downloading the installer](https://www.docker.com/products/docker-desktop/) for your operating system.
7+
To get started, you have to install [Docker](https://www.docker.com/). This can be either Docker Engine, which can be installed by following the [Docker Engine Installation Manual](https://docs.docker.com/engine/install/) or Docker Desktop, which can be installed by [downloading the installer](https://www.docker.com/products/docker-desktop/) for your operating system. If you want to use Docker Compose to run the ComfyUI Docker container, then Docker Compose must also be installed. Docker Desktop comes with Docker Compose pre-installed. If you are using Docker Engine, you may already have Docker Compose installed. You can check this by running `docker compose version` in your terminal. If Docker Compose is not installed, you can follow the [Docker Compose Installation Manual](https://docs.docker.com/compose/install/) to install it.
88

99
To enable the usage of NVIDIA GPUs, the NVIDIA Container Toolkit must be installed. The installation process is detailed in the [official documentation](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)
1010

11-
## Installation
11+
## Installation & Running
1212

13-
The ComfyUI Docker image is available from the [GitHub Container Registry](https://ghcr.io). Installing ComfyUI is as simple as pulling the image and starting a container, which can be achieved using the following command:
13+
### Installing & Running Using Docker Run
14+
15+
The ComfyUI Docker image is available from the [GitHub Container Registry](ghcr.io/lecode-official/comfyui-docker). Installing ComfyUI is as simple as pulling the image and starting a container, which can be achieved using the following command:
1416

1517
```shell
1618
docker run \
@@ -30,70 +32,120 @@ docker run \
3032

3133
Please note, that the `<path/to/models/folder>`, `<path/to/custom/nodes/folder>` and `<path/to/output/folder>` must be replaced with paths to directories on the host system where the models, custom nodes and generated outputs (images, workflows, etc.) will be stored, e.g., `$HOME/.comfyui/models`, `$HOME/.comfyui/custom-nodes` and `$HOME/.comfyui/output`, which can be created like so: `mkdir -p $HOME/.comfyui/{models,custom-nodes,output}`.
3234

33-
The `--detach` flag causes the container to run in the background and `--restart unless-stopped` configures the Docker Engine to automatically restart the container if it stopped itself, experienced an error, or the computer was shutdown, unless you explicitly stopped the container using `docker stop`. This means that ComfyUI will be automatically started in the background when you boot your computer. The two `--env` arguments inject the user ID and group ID of the current host user into the container. During startup, a user with the same user ID and group ID will be created, and ComfyUI will be run using this user. This ensures that files written to the volumes (e.g., models and custom nodes installed with the ComfyUI Manager) will be owned by the host system's user. Normally, the user inside the container is `root`, which means that the files that are written from the container to the host system are also owned by `root`. If you have run ComfyUI Docker without setting the environment variables, then you may have to change the owner of the files in the models and custom nodes directories: `sudo chown -r "$(id -un):$(id -gn)" <path/to/models/folder> <path/to/custom/nodes/folder>`. The `--runtime nvidia` and `--gpus all` arguments enable ComfyUI to access the GPUs of your host system. If you do not want to expose all GPUs, you can specify the desired GPU index or ID instead.
35+
> [!WARNING]
36+
> If you are coming from a version prior to v0.6.0, please note that the output directory mapping was added in version v0.6.0. If the Docker container for the previous version is still available, you can migrate your existing outputs by copying them from the old container to the host system. Assuming your previous container was named `comfyui`, you can use the following command:
37+
>
38+
> ```shell
39+
> docker cp comfyui:/opt/comfyui/output/. <path/to/output/folder>
40+
> ```
41+
42+
The `--detach` flag causes the container to run in the background and `--restart unless-stopped` configures the Docker Engine to automatically restart the container if it stopped itself, experienced an error, or the computer was shutdown, unless you explicitly stopped the container using `docker stop`. This means that ComfyUI will be automatically started in the background when you boot your computer. The two `--env` arguments inject the user ID and group ID of the current host user into the container. During startup, a user with the same user ID and group ID will be created, and ComfyUI will be run using this user. This ensures that files written to the volumes (e.g., models, custom nodes installed with the ComfyUI Manager, and outputs) will be owned by the host system's user. Normally, the user inside the container is `root`, which means that the files that are written from the container to the host system are also owned by `root`. If you have run ComfyUI Docker without setting the environment variables, then you may have to change the owner of the files in the models and custom nodes directories: `sudo chown -r "$(id -un):$(id -gn)" <path/to/models/folder> <path/to/custom/nodes/folder> <path/to/output/folder>`. The `--runtime nvidia` and `--gpus all` arguments enable ComfyUI to access the GPUs of your host system. If you do not want to expose all GPUs, you can specify the desired GPU index or ID instead.
3443
3544
After the container has started, you can navigate to [localhost:8188](http://localhost:8188) to access ComfyUI.
3645
37-
If you want to stop ComfyUI, you can use the following commands:
46+
If you want to pass additional command line arguments to ComfyUI, you can do so by specifying them as the command when starting the container. For example, if you want to allow external web apps to connect to ComfyUI in the container, you can add the `--enable-cors-header` argument like so:
47+
48+
```shell
49+
docker run \
50+
--name comfyui \
51+
--detach \
52+
--restart unless-stopped \
53+
--env USER_ID="$(id -u)" \
54+
--env GROUP_ID="$(id -g)" \
55+
--volume "<path/to/models/folder>:/opt/comfyui/models:rw" \
56+
--volume "<path/to/custom/nodes/folder>:/opt/comfyui/custom_nodes:rw" \
57+
--volume "<path/to/output/folder>:/opt/comfyui/output:rw" \
58+
--publish 8188:8188 \
59+
--runtime nvidia \
60+
--gpus all \
61+
ghcr.io/lecode-official/comfyui-docker:latest \
62+
--enable-cors-header <origin>
63+
```
64+
65+
You can stop ComfyUI Docker using the following command:
3866
3967
```shell
4068
docker stop comfyui
69+
```
70+
71+
This will keep the container on your system, so that you can start it again later using:
72+
73+
```shell
74+
docker start comfyui
75+
```
76+
77+
To completely remove the container from your system, you can use the following command:
78+
79+
```shell
4180
docker rm comfyui
4281
```
4382
4483
> [!WARNING]
45-
> While the custom nodes themselves are installed outside of the container, their requirements are installed inside of the container. This means that stopping and removing the container will remove the installed requirements. When the container is started again, the requirements will be automatically installed, but this may, depending on the number of custom nodes and their requirements, take some time.
46-
47-
## Docker Compose
48-
49-
Instead of using `docker run`, you can use the provided `docker-compose.yml` in this repository for easier management and updates.
50-
51-
1. (First time) Create the required host directories:
52-
```shell
53-
mkdir -p $HOME/.comfyui/{models,custom-nodes,output}
54-
```
55-
2. (Optional) Create a `.env` file next to `docker-compose.yml` to pin your user / group IDs:
56-
```shell
57-
echo "UID=$(id -u)" > .env
58-
echo "GID=$(id -g)" >> .env
59-
```
60-
If omitted, the defaults `1000` / `1000` in the compose file are used.
61-
3. Start (or bring up after changes):
62-
```shell
63-
docker compose up -d
64-
```
65-
4. View logs:
66-
```shell
67-
docker compose logs -f
68-
```
69-
5. Update later:
70-
```shell
71-
docker compose pull
72-
docker compose up -d
73-
```
74-
6. Stop / remove the container (keeps your data in the host directories):
75-
```shell
76-
docker compose down
77-
```
78-
79-
Custom CLI arguments: edit the `command:` line in `docker-compose.yml` (uncomment or add) e.g.:
80-
```yaml
81-
command: ["--enable-cors-header", "*"]
84+
> While the custom nodes themselves are installed outside of the container, their requirements are installed inside of the container. Also, in versions prior to v0.6.0, the outputs of ComfyUI were stored inside of the container. This means that removing the container will remove the installed requirements and all outputs you have not saved manually. When the container is started again, the requirements will be automatically installed, but this may, depending on the number of custom nodes and their requirements, take some time.
85+
86+
### Installing & Running Using Docker Compose
87+
88+
Instead of using `docker run`, you can use the provided [`compose.yml`](compose.yml) in this repository to make running, managing and updating ComfyUI Docker easier.
89+
90+
Models, custom nodes, and outputs are stored on the host system, by default in the `$HOME/.comfyui/models`, `$HOME/.comfyui/custom-nodes`, and `$HOME/.comfyui/output` directories, respectively. If you are running ComfyUI Docker for the first time, you have to create the required host directories for models, custom nodes, and outputs. You can do this by running:
91+
92+
```shell
93+
mkdir -p $HOME/.comfyui/{models,custom-nodes,output}
94+
```
95+
96+
You can change the paths to these directories using the `MODELS_PATH`, `CUSTOM_NODES_PATH`, and `OUTPUT_PATH` environment variables, respectively. To permanently set these environment variables, you can create a `.env` file alongside the [`compose.yml`](compose.yml) file with the following content:
97+
98+
```shell
99+
MODELS_PATH=<path/to/models/folder>
100+
CUSTOM_NODES_PATH=<path/to/custom/nodes/folder>
101+
OUTPUT_PATH=<path/to/output/folder>
102+
```
103+
104+
Normally, the user inside a Docker container is `root`, which means that the files that are written from the container to the host system are also owned by `root`. To avoid this, ComfyUI Docker creates a new user inside the container. By default, running the Docker Compose file will create a user and group with the IDs `1000` and `1000`, respectively. Most Linux systems have the first user created with these IDs. If your user has different IDs, you can change them using the `USER_ID` and `GROUP_ID` environment variables. To permanently set these environment variables, you can create a `.env` file alongside the `compose.yml` file to specify the correct IDs. You can find out your user and group IDs by running `id -u` and `id -g` in your terminal. To create the `.env` file, you can run:
105+
106+
```shell
107+
echo "USER_ID=$(id -u)" > .env
108+
echo "GROUP_ID=$(id -g)" >> .env
82109
```
83-
Then apply changes:
110+
111+
After this, you can start ComfyUI Docker using Docker Compose:
112+
113+
```shell
114+
docker compose up --detach
115+
```
116+
117+
If the ComfyUI Docker image is not available locally, it will be pulled automatically. This will start ComfyUI in the background. The --detach flag causes the container to run in the background. You can then navigate to [localhost:8188](http://localhost:8188) to access ComfyUI.
118+
119+
Docker Compose will automatically assign all NVIDIA GPUs of your host system to the container. If you do not want to expose all GPUs, you have to update the `compose.yml` file to specify the desired GPUs under the `services.comfyui.deploy.resources.reservations.devices` section. `count: all` assigns all available GPUs to the container. You can replace it with `count: 1` to assign only one GPU, or you can specify specific GPU indices or IDs using the `device_ids` field. For example, to assign GPU-0 and GPU-3, you can specify `device_ids: ['0', '3']`.
120+
121+
To view the logs of the running container, you can use the following command:
122+
84123
```shell
85-
docker compose up -d --force-recreate
124+
docker compose logs --follow
86125
```
87126
88-
Migrating existing outputs from a previously created container (non‑compose):
127+
The `--follow` flag will continuously stream the logs to your terminal. Omitting this flag will show you the existing logs and then exit. To stop ComfyUI, you can use the following command:
128+
89129
```shell
90-
docker cp comfyui:/opt/comfyui/output/. $HOME/.comfyui/output/
130+
docker compose down
131+
```
132+
133+
This will stop the container and remove it from your system. If you need to run ComfyUI with custom arguments using Docker Compose, you can do so by adding a `command` section to the ComfyUI service in the `compose.yml` file. For example, to allow external web apps to connect to ComfyUI in the container, you can add the `--enable-cors-header` argument:
134+
135+
```yaml
136+
command: ["--enable-cors-header", "*"]
91137
```
92138
93-
After this, you can remove the old container and strictly use compose.
139+
To apply the changes, you have to recreate the container:
140+
141+
```shell
142+
docker compose up --detach --force-recreate
143+
```
94144
95145
## Updating
96146
147+
### Updating Using Docker Run
148+
97149
To update ComfyUI Docker to the latest version you have to first stop the running container, then pull the new version, optionally remove dangling images, and then restart the container:
98150
99151
```shell
@@ -118,30 +170,15 @@ docker run \
118170
ghcr.io/lecode-official/comfyui-docker:latest
119171
```
120172
121-
If you want to pass additional command line arguments to ComfyUI, you can do so by specifying them as the command when starting the container. For example, if you want to allow external web apps to connect to ComfyUI in the container, you can add the `--enable-cors-header` argument like so:
173+
### Updating Using Docker Compose
122174
123-
```shell
124-
docker run \
125-
--name comfyui \
126-
--detach \
127-
--restart unless-stopped \
128-
--env USER_ID="$(id -u)" \
129-
--env GROUP_ID="$(id -g)" \
130-
--volume "<path/to/models/folder>:/opt/comfyui/models:rw" \
131-
--volume "<path/to/custom/nodes/folder>:/opt/comfyui/custom_nodes:rw" \
132-
--volume "<path/to/output/folder>:/opt/comfyui/output:rw" \
133-
--publish 8188:8188 \
134-
--runtime nvidia \
135-
--gpus all \
136-
ghcr.io/lecode-official/comfyui-docker:latest \
137-
--enable-cors-header <origin>
138-
```
175+
To update ComfyUI Docker using Docker Compose, you have to stop the service first, then pull the new images, and restart it like so:
139176
140-
With Docker Compose:
141177
```shell
142-
docker compose up -d --force-recreate
178+
docker compose down
179+
docker compose pull
180+
docker compose up --detach
143181
```
144-
(Add or edit the `command:` line in the compose file.)
145182
146183
## Building
147184

compose.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
3+
name: comfyui-docker
4+
5+
services:
6+
comfyui:
7+
image: ghcr.io/lecode-official/comfyui-docker:latest
8+
container_name: comfyui
9+
restart: unless-stopped
10+
environment:
11+
USER_ID: "${USER_ID:-1000}"
12+
GROUP_ID: "${GROUP_ID:-1000}"
13+
ports:
14+
- "8188:8188"
15+
volumes:
16+
- ${MODELS_PATH:-${HOME}/.comfyui/models}:/opt/comfyui/models:rw
17+
- ${CUSTOM_NODES_PATH:-${HOME}/.comfyui/custom-nodes}:/opt/comfyui/custom_nodes:rw
18+
- ${OUTPUT_PATH:-${HOME}/.comfyui/output}:/opt/comfyui/output:rw
19+
deploy:
20+
resources:
21+
reservations:
22+
devices:
23+
- driver: nvidia
24+
count: all
25+
capabilities: [gpu]

0 commit comments

Comments
 (0)