This guide provides step-by-step instructions for installing and running ComfyUI within a containerized environment (using Podman as a drop-in replacement for Docker) specifically configured for ROCm GFX1151 compatibility.
Performance is pretty reasonable, generating a basic image using Illustrious at 832x1216 at 32 steps in about 21 seconds
Since the provided commands use the docker syntax, we set up an alias so that your system executes podman when you type docker.
-
Open your shell configuration file (usually ~/.bashrc or ~/.zshrc).
-
Add the following line to the end of the file:
alias docker='podman' -
Save the file and reload your shell configuration:
source ~/.bashrc
# or source ~/.zshrcYou can now proceed with the docker commands in the next steps, which will automatically run via podman.
These commands create your environment, clone the ComfyUI repository, and install the necessary dependencies, including specific PyTorch wheel files.
-
Create the ComfyUI Directory on your host machine:
mkdir ComfyUI -
Run the container. This command starts the ROCm development image, maps your local ComfyUI directory to /opt/ComfyUI, exposes port 8188, and places you inside an interactive shell:
docker run -it --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --device=/dev/kfd --device=/dev/dri --group-add video -v `pwd`/ComfyUI:/opt/ComfyUI -p 8188:8188 --ipc=host ghcr.io/rocm/therock_pytorch_dev_ubuntu_24_04_gfx1151:main -
Navigate to the installation directory inside the container:
cd opt/ComfyUI -
Install git and clone the ComfyUI repository:
apt update
apt install git -y
git clone [https://github.com/comfyanonymous/ComfyUI\](https://github.com/comfyanonymous/ComfyUI) .
-
Uninstall any existing PyTorch packages to prevent conflicts:
pip uninstall torch torchvision torchaudio --break-system-packages -y -
Install ROCm core packages:
pip install --index-url [https://d2awnip2yjpvqn.cloudfront.net/v2/gfx1151/\](https://d2awnip2yjpvqn.cloudfront.net/v2/gfx1151/) rocm[libraries,devel] --break-system-packages -
Install specific wheel files.Note: You must first download the torch wheel files and put them in your bazzite ComfyUI directory (Host Machine: ComfyUI/). The necessary files can be found here: https://github.com/pccr10001/comfyui-gfx1151-fa.
pip install ./torch-2.8.0a0+gitba56102-cp312-cp312-linux_x86_64.whl ./torchaudio-2.8.0a0+6e1c7fe-cp312-cp312-linux_x86_64.whl ./torchvision-0.23.0a0+824e8c8-cp312-cp312-linux_x86_64.whl ./flash_attn-2.0.4-cp312-cp312-linux_x86_64.whl --break-system-packages -
Install the remaining requirements:
pip install -r requirements.txt --break-system-packages -
Configure dynamic linker run-time bindings:
echo /usr/local/lib/python3.12/dist-packages/_rocm_sdk_core/lib >> /etc/ld.so.conf
ldconfig -
Run ComfyUI (inside the container):
PYTORCH_TUNABLEOP_ENABLED=1 MIOPEN_FIND_MODE=FAST ROCBLAS_USE_HIPBLASLT=1 python3 main.py --listen 0.0.0.0 --use-flash-attention -
Access the GUI in your web browser:
[http://0.0.0.0:8188\](http://0.0.0.0:8188)
If you close the shell or restart your machine, the container will exit. Here’s how to get back into it.
-
List all containers to find the stopped one:
docker ps -a -
Note the container ID or Name (e.g., ecstatic_hopper).
-
Restart the Container:
docker start <CONTAINER_ID_OR_NAME> -
Get an Interactive Shell inside the running container:
docker exec -it <CONTAINER_ID_OR_NAME> /bin/bash -
Run ComfyUI:
PYTORCH_TUNABLEOP_ENABLED=1 MIOPEN_FIND_MODE=FAST ROCBLAS_USE_HIPBLASLT=1 python3 main.py --listen 0.0.0.0 --use-flash-attention
To simplify the process of restarting and launching ComfyUI, you can create a shell script.
-
Navigate to your ComfyUI directory on the host machine:
cd /var/home//ComfyUI/ -
Create a new file named launch_comfy.sh:
nano launch_comfy.sh -
Paste the following content into the file:
#!/bin/bash# --- Configuration ---
# !! IMPORTANT: Update CONTAINER_NAME if you used a specific name during initial run !!
CONTAINER_NAME="comfyui_rocm_container_name"
COMFY_CMD="PYTORCH_TUNABLEOP_ENABLED=1 MIOPEN_FIND_MODE=FAST ROCBLAS_USE_HIPBLASLT=1 python3 main.py --listen 0.0.0.0 --use-flash-attention"# --- Logic ---
# 1. Check if the container exists (including stopped ones)
CONTAINER_STATUS=$(docker ps -a --filter "name=$CONTAINER_NAME" --format "{{.Status}}")if [ -z "$CONTAINER_STATUS" ];
then
echo "Container '$CONTAINY_NAME' not found. You need to run the initial 'docker run' command again to create it."
exit 1
fi# 2. Check if the container is running (using podman due to the alias)
if [[ "$CONTAINER_STATUS" == Running* ]];
then
echo "Container is already running. Attaching shell and launching ComfyUI..."
else
echo "Container is stopped ($CONTAINER_STATUS). Starting it now..."
podman start "$CONTAINER_NAME"
fi# 3. Execute the ComfyUI launch command inside the running container (using podman due to the alias)
podman exec -it "$CONTAINER_NAME" /bin/bash -c "cd /opt/ComfyUI && $COMFY_CMD" -
Save and close the file.
chmod +x launch_comfy.sh
./launch_comfy.sh
You can create a desktop launcher to execute the script with a single click.
-
Navigate to your desktop directory (Host Machine):
cd /var/home//Desktop -
Create a new file named ComfyUI.desktop:
nano ComfyUI.desktop -
Paste the following content:
[Desktop Entry]
Comment=Launch ComfyUI in a Docker Container
Exec=/var/home//ComfyUI/launch_comfy.sh
GenericName=ComfyUI Launcher
Icon=application-x-executable
Name=ComfyUI
StartupNotify=true
Terminal=true
Type=Application
Version=1.0 -
Save and close the file.
-
Make the Desktop Entry Executable:
chmod +x ComfyUI.desktop
