I’m running Ubuntu with rocm 7.1.1, so I’m not sure how relevant this will be to you, but I also run ComfyUI through docker, so that part might make the setup of ComfyUI itself a bit easier.
It’s a little jumbled, but here is the exact setup that I did on a fresh install of Ubuntu 24.04:
sudo apt update
sudo apt upgrade
sudo apt install openssh-server
sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt update
sudo usermod -a -G render,video $LOGNAME
wget https://repo.radeon.com/amdgpu-install/7.1.1/ubuntu/noble/amdgpu-install_7.1.1.70101-1_all.deb
sudo apt install ./amdgpu-install_7.1.1.70101-1_all.deb
sudo apt update
sudo apt install python3-setuptools python3-wheel
sudo apt install rocm
amdgpu-install --usecase=dkms
sudo modprobe amdgpu
sudo reboot
sudo apt update
sudo apt install gpg
sudo mkdir --parents --mode=0755 /etc/apt/keyrings
wget https://repo.radeon.com/rocm/rocm.gpg.key -O - | gpg --dearmor | sudo tee /etc/apt/keyrings/rocm.gpg > /dev/null
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/amd-container-toolkit/apt/ noble main" | sudo tee /etc/apt/sources.list.d/amd-container-toolkit.list
sudo apt update
sudo apt install amd-container-toolkit
sudo amd-ctk runtime configure
sudo systemctl restart docker
I then have a modified version of GitHub - Kaouthia/ComfyUI-Docker: Dockerfile and Docker Compose setup for ComfyUI - Works on Linux or Windows with NVIDIA GPUs to make it work with AMD:
Dockerfile:
# Use rocm pytorch image. It's a bit heavy, but it saves you from a lot of config issues later on
FROM rocm/pytorch:rocm7.1.1_ubuntu24.04_py3.12_pytorch_release_2.9.1
# Copy and enable the startup script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Probably don't need this
RUN apt-get update && apt-get install rocm
# make ~/.local/bin available on the PATH so scripts like tqdm, torchrun, etc. are found
ENV PATH=/home/appuser/.local/bin:$PATH
# Set the working directory
WORKDIR /app
# Clone the ComfyUI repository (replace URL with the official repo)
RUN git clone https://github.com/comfyanonymous/ComfyUI.git
# Change directory to the ComfyUI folder
WORKDIR /app/ComfyUI
# Install ComfyUI dependencies
RUN pip install --no-cache-dir -r requirements.txt
# (Optional) Clean up pip cache to reduce image size
RUN pip cache purge
# Expose the port that ComfyUI will use (change if needed)
EXPOSE 8188
# Run entrypoint first, then start ComfyUI
ENTRYPOINT ["/entrypoint.sh"]
CMD ["python","/app/ComfyUI/main.py","--listen","0.0.0.0"]
docker-compose.yml
services:
comfyk:
build:
dockerfile: Dockerfile
image: comfyui:latest
container_name: comfyui
ports:
- "8188:8188"
volumes:
- ../comfyui/models:/app/ComfyUI/models
- ../comfyui/output:/app/ComfyUI/output
- ../comfyui/settings:/app/ComfyUI/user/default:rw
- ../comfyui/flows:/app/ComfyUI/user/default/workflows:rw
group_add:
- video
- render
runtime: amd
deploy:
resources:
reservations:
devices:
- driver: amd
count: all
capabilities: [gpu]
stdin_open: true
tty: true
command: ["python","/app/ComfyUI/main.py","--listen","0.0.0.0","--highvram"]
entrypoint.sh - is pretty much unchanged from ComfyUI-Docker/entrypoint.sh at main · Kaouthia/ComfyUI-Docker · GitHub I just removed a few plugins I didn’t want.
#!/usr/bin/env bash
# ComfyUI Docker Startup File v1.0.2 by John Aldred
# http://www.johnaldred.com
# http://github.com/kaouthia
set -e
# --- Force ComfyUI-Manager config (uv off, no file logging, safe DB) ---
# Make sure user dirs exist and are writable (handles Windows bind mounts)
mkdir -p /app/ComfyUI/user /app/ComfyUI/user/default
chown -R "$(id -u)":"$(id -g)" /app/ComfyUI/user || true
chmod -R u+rwX /app/ComfyUI/user || true
CFG_DIR="/app/ComfyUI/user/default/ComfyUI-Manager"
CFG_FILE="$CFG_DIR/config.ini"
DB_DIR="$CFG_DIR"
DB_PATH="${DB_DIR}/manager.db"
SQLITE_URL="sqlite:////${DB_PATH}"
mkdir -p "$CFG_DIR"
if [ ! -f "$CFG_FILE" ]; then
echo "↳ Creating ComfyUI-Manager config.ini (uv OFF, no file logging, DB cache)"
cat > "$CFG_FILE" <<EOF
[default]
use_uv = False
file_logging = False
db_mode = cache
database_url = ${SQLITE_URL}
EOF
else
echo "↳ Updating ComfyUI-Manager config.ini (uv OFF, no file logging, DB cache)"
# use_uv = False
grep -q '^use_uv' "$CFG_FILE" \
&& sed -i 's/^use_uv.*/use_uv = False/' "$CFG_FILE" \
|| printf '\nuse_uv = False\n' >> "$CFG_FILE"
# file_logging = False (and drop any existing log_path line)
grep -q '^file_logging' "$CFG_FILE" \
&& sed -i 's/^file_logging.*/file_logging = False/' "$CFG_FILE" \
|| printf '\nfile_logging = False\n' >> "$CFG_FILE"
sed -i '/^log_path[[:space:]=]/d' "$CFG_FILE" || true
# db_mode = cache (prevents file DB usage)
grep -q '^db_mode' "$CFG_FILE" \
&& sed -i 's/^db_mode.*/db_mode = cache/' "$CFG_FILE" \
|| printf '\ndb_mode = cache\n' >> "$CFG_FILE"
# Provide a safe DB URL anyway (future-proof if Manager flips off cache)
grep -q '^database_url' "$CFG_FILE" \
&& sed -i "s|^database_url.*|database_url = ${SQLITE_URL}|" "$CFG_FILE" \
|| printf "database_url = ${SQLITE_URL}\n" >> "$CFG_FILE"
fi
# --- Prepare custom nodes ---
CN_DIR=/app/ComfyUI/custom_nodes
INIT_MARKER="$CN_DIR/.custom_nodes_initialized"
declare -A REPOS=(
["ComfyUI-Manager"]="https://github.com/ltdrdata/ComfyUI-Manager.git"
["ComfyUI_essentials"]="https://github.com/cubiq/ComfyUI_essentials.git"
["ComfyUI-KJNodes"]="https://github.com/kijai/ComfyUI-KJNodes.git"
["ComfyUI_UltimateSDUpscale"]="https://github.com/ssitu/ComfyUI_UltimateSDUpscale.git"
)
if [ ! -f "$INIT_MARKER" ]; then
echo "↳ First run: initializing custom_nodes…"
mkdir -p "$CN_DIR"
for name in "${!REPOS[@]}"; do
url="${REPOS[$name]}"
target="$CN_DIR/$name"
if [ -d "$target" ]; then
echo " ↳ $name already exists, skipping clone"
else
echo " ↳ Cloning $name"
git clone --depth 1 "$url" "$target"
fi
done
echo "↳ Installing/upgrading dependencies…"
for dir in "$CN_DIR"/*/; do
req="$dir/requirements.txt"
if [ -f "$req" ]; then
echo " ↳ pip install --upgrade -r $req"
python -m pip install --no-cache-dir --upgrade -r "$req"
fi
done
# Create marker file
touch "$INIT_MARKER"
else
echo "↳ Custom nodes already initialized, skipping clone and dependency installation."
fi
echo "↳ Launching ComfyUI"
exec "$@"
Hope that’s in some part useful