Parameterize image, name, restart, and GPU

This commit is contained in:
2026-07-18 08:58:19 -04:00
parent a632cc1054
commit 15eb203b2f
2 changed files with 40 additions and 16 deletions
+36 -12
View File
@@ -1,22 +1,46 @@
# docker-comfyui # docker-comfyui
Build and run ComfyUI in a container. This build targets NVIDIA by basing it Build and run ComfyUI in a container. This build targets NVIDIA by basing it on
on the CUDA PyTorch runtime image. The only extra dependencies needed are the CUDA PyTorch runtime image. The only extra dependencies needed are `git`, to
`git`, to clone the official ComfyUI repository, and `build-essential` for clone the official ComfyUI repository, and `build-essential` for `gcc`, which
`gcc`, which Triton requires. The image pulls a specific, pinned ComfyUI Triton requires. The image pulls a specific, pinned ComfyUI version via the
version via the `COMFYUI_VERSION` build arg. The build merely shallow-clones `COMFYUI_VERSION` build arg. The build merely shallow-clones the repo and
the repo and installs its requirements with `pip`. Kept intentionally simple. installs its requirements with `pip`. Kept intentionally simple.
### `.env` configuration
- `IMAGE`
- Image name
- Default: `localhost/comfyui`
- `VERSION`
- Image tag
- Default: `latest`
- `NAME`
- Container name
- Default: `comfyui`
- `RESTART`
- Restart policy
- Default: `unless-stopped`
- `ENDPOINT`
- Host bind
- Default: `127.0.0.1:8188`
- `DATA`
- Host directory holding all persistent data
- Default: `./data`
- `GPU`
- CDI device
- Default: `nvidia.com/gpu=all`
### Quick start ### Quick start
1. Build 1. Build
``` ```
docker compose build docker compose build
``` ```
2. Run 2. Run
``` ```
docker compose up -d docker compose up -d
``` ```
+4 -4
View File
@@ -2,9 +2,9 @@ services:
comfyui: comfyui:
build: build:
context: . context: .
image: localhost/comfyui:latest image: ${IMAGE:-localhost/comfyui}:${VERSION:-latest}
restart: unless-stopped container_name: ${NAME:-comfyui}
container_name: comfyui restart: ${RESTART:-unless-stopped}
ports: ports:
- "${ENDPOINT:-127.0.0.1:8188}:8188" - "${ENDPOINT:-127.0.0.1:8188}:8188"
volumes: volumes:
@@ -15,4 +15,4 @@ services:
- ${DATA:-./data}/custom_nodes:/app/custom_nodes - ${DATA:-./data}/custom_nodes:/app/custom_nodes
- ${DATA:-./data}/triton-cache:/root/.triton - ${DATA:-./data}/triton-cache:/root/.triton
devices: devices:
- nvidia.com/gpu=all - ${GPU:-nvidia.com/gpu=all}