Back to Blog
Tutorials

How to Run LTX-2.5 in Docker

Run LTX-2.5 in Docker with GPU access: NVIDIA Container Toolkit setup, a Dockerfile for ltx-pipelines, mounted model weights, and a ComfyUI Docker option.

LTX Team
Tutorials
How to Run LTX-2.5 in Docker
Key Takeaways
  • Give Docker the GPU with the NVIDIA Container Toolkit and build an LTX-2.5 image
  • Keep the ~66 GiB weights and Hugging Face token out of the image with mounts
  • Run the distilled pipeline, ComfyUI in Docker, and docker compose with GPU reservations

‍

‍

LTX-2.5 runs in Docker once you wrap the documented install (clone the Lightricks/LTX-2 repository, uv sync, run the ltx_pipelines CLI) in a CUDA container, keep the model weights on a mounted volume, and hand the GPU to the container through the NVIDIA Container Toolkit. The LTX documentation does not publish an official Docker image, so the Dockerfile below is our assembly of the documented install steps, not an LTX-maintained image.

Prerequisites: the LTX-2.5 system requirements call for an NVIDIA GPU with 32GB+ VRAM, 32GB of system RAM, CUDA 12.7 or higher, Python 3.12+, and 100GB of free storage, with an A100 (80GB) or H100 and a 200GB+ SSD recommended. Use a Linux host: the NVIDIA Container Toolkit install guide targets Linux distributions, and the natten extra is Linux + CUDA only. If that hardware is out of reach, the hosted LTX API runs ltx-2-5-fast and ltx-2-5-pro without a local GPU.

What does the container need?

The container needs three things from the host and one thing it must never contain. From the host: an NVIDIA driver, GPU access through the container runtime, and enough RAM and disk for the model. What it must not contain is the weights. The distilled LTX-2.5 quick-start set is roughly 66 GiB according to the Lightricks/LTX-2 README, and baking that into an image makes every rebuild, push, and pull carry it. Keep the image to code and dependencies, and mount the weights.

LTX-2.5 ships as a split pack, one .safetensors file per component (transformer, text encoder, video and audio VAEs, duration head), with the spatial upscaler as a separate download. Each one is passed to the pipeline with its own path flag, which makes a read-only volume mount the natural fit. For a broader hardware view, see our hardware guide for AI video models.

How do you give Docker the GPU?

Docker GPU access on Linux goes through the NVIDIA Container Toolkit. Following the NVIDIA install guide, install the NVIDIA driver for your distribution, install the nvidia-container-toolkit packages from NVIDIA's repository, then configure Docker and restart it:

sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
docker run --rm --gpus all nvidia/cuda:12.9.0-base-ubuntu22.04 nvidia-smi

The nvidia-ctk command updates /etc/docker/daemon.json so Docker can use the NVIDIA Container Runtime. If the last command prints your GPU table, every later step will see the GPU too. If it fails, fix it here; nothing in the LTX-2.5 stack will work around a missing runtime.

Write the Dockerfile

The Dockerfile mirrors the documented install: uv, a clone of the Lightricks/LTX-2 monorepo, and uv sync --frozen, which installs exactly what the repository's lockfile specifies. The uv installer line comes from the LTX Dub-It setup docs.

FROM nvidia/cuda:12.9.0-base-ubuntu22.04
RUN apt-get update && apt-get install -y --no-install-recommends git curl ca-certificates \
   && rm -rf /var/lib/apt/lists/*
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:$PATH"
WORKDIR /opt
RUN git clone https://github.com/Lightricks/LTX-2.git
WORKDIR /opt/LTX-2
RUN uv python install 3.12 && uv sync --frozen
ENV PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
ENTRYPOINT ["/opt/LTX-2/.venv/bin/python", "-m"]

Choose your video VAE before you build. The README describes the natten extra (uv sync --extra natten) as the fastest backend for the diffusion video VAE. It pins torch==2.13.0 built for CUDA 13.2, so the host driver has to support that CUDA version. Without the extra, decoding falls back to Triton or eager attention. The alternative is the convolutional VAE (ltx-2.5-video-vae-conv-bf16.safetensors), which is lighter and needs no extra dependencies. On older drivers, the conv VAE is the simpler container.

PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True is the memory-allocation tip from the LTX PyTorch API docs. For production images, pin the repository commit and the uv version, and run as a non-root user.

Build the image with docker build -t ltx-video:2.5 . so the run commands below can reference that tag.

Keep the weights outside the image

Model weights for LTX-2.5 belong on the host. Download them once with the documented Hugging Face CLI command into a host directory such as /srv/ltx/models/ltx-2.5:

hf auth login
hf download Lightricks/LTX-2.5 \
 diffusion_models/ltx-2.5-22b-distilled-transformer-bf16.safetensors \
 text_encoders/gemma4-12b-with-proj-ltx-2.5-bf16.safetensors \
 vae/ltx-2.5-video-vae-bf16.safetensors \
 vae/ltx-2.5-audio-vae-bf16.safetensors \
 latent_upscale_models/ltx-2.5-latent-spatial-upscaler-x2-bf16-1.0.safetensors \
 --local-dir /srv/ltx/models/ltx-2.5

The repository is gated. The README says a 401 or 403 means you need to accept the model terms on Hugging Face and log in with a Read token, and fine-grained tokens need the "read gated repos" scope. Never put that token in a Dockerfile ENV or ARG: build-time values persist in image layers and history. Downloading on the host keeps the token out of the image entirely.

Run the distilled pipeline

The distilled pipeline is the fastest documented path, using 8 predefined sigmas. Mount the weights read-only, mount an output folder, and pass the documented flags:

docker run --rm --gpus all \
 -v /srv/ltx/models:/models:ro -v /srv/ltx/out:/out \
 ltx-video:2.5 ltx_pipelines.distilled \
 --transformer-path /models/ltx-2.5/diffusion_models/ltx-2.5-22b-distilled-transformer-bf16.safetensors \
 --text-encoder-path /models/ltx-2.5/text_encoders/gemma4-12b-with-proj-ltx-2.5-bf16.safetensors \
 --video-vae-path /models/ltx-2.5/vae/ltx-2.5-video-vae-bf16.safetensors \
 --audio-vae-path /models/ltx-2.5/vae/ltx-2.5-audio-vae-bf16.safetensors \
 --spatial-upsampler-path /models/ltx-2.5/latent_upscale_models/ltx-2.5-latent-spatial-upscaler-x2-bf16-1.0.safetensors \
 --num-frames 121 --seed 42 --output-path /out/output.mp4 \
 --prompt "A lighthouse keeper climbs a spiral staircase at dusk, wind rattling the windows."

Frame counts must satisfy (F-1) % 8 == 0, so 121 frames (about 5.0s at 24fps) is valid and 120 is not. Width and height must be divisible by 32.

On 32GB-class GPUs, add --quantization fp8-cast --offload cpu. fp8-cast downcasts the bf16 transformer on the fly, and --offload cpu streams weights from system RAM per layer, so a container started with a tight --memory limit undercuts the offload. --offload disk reads weights from disk on demand, which makes the speed of the mounted volume part of your generation time. Our quantization formats explainer covers the trade-offs.

Can you run ComfyUI in Docker?

ComfyUI runs in Docker with the same GPU setup, and it is the path the LTX docs recommend for most users. Inside the image, install ComfyUI and the ComfyUI-LTXVideo node pack (clone it into ComfyUI/custom_nodes and install its requirements.txt, per the LTX ComfyUI guide). Then mount host folders onto the model directories the guide lists: diffusion_models, text_encoders, vae, latent_upscale_models, and loras.

The mount matters more in ComfyUI Docker setups than in the CLI. The LTX-2.5 templates offer Download all for missing model files, and without a mounted models folder those downloads land in the container's writable layer and vanish with it. The prompt enhancer file, gemma4_e2b_it_bf16.safetensors, comes from Comfy-Org/gemma-4, not the LTX-2.5 repository.

Publish the ComfyUI port to 127.0.0.1 only (for example -p 127.0.0.1:8188:8188) and reach it over SSH or a reverse proxy with authentication. Binding it to every interface exposes an unauthenticated generation UI on your GPU host. For a hosted alternative, see ComfyUI cloud setup for LTX-2.5.

Use docker compose for repeat runs

Docker Compose GPU access uses a device reservation. The Docker Compose GPU docs state that capabilities must be set, and that count and device_ids are mutually exclusive:

services:
 ltx:
   image: ltx-video:2.5
   volumes: ["/srv/ltx/models:/models:ro", "/srv/ltx/out:/out"]
   deploy:
     resources:
       reservations:
         devices:
           - driver: nvidia
             count: 1
             capabilities: [gpu]

On a multi-GPU host, swap count for device_ids to pin each service to a specific card.

Troubleshooting LTX-2.5 containers

• nvidia-smi fails inside the container: rerun nvidia-ctk runtime configure and restart Docker.

• 401 or 403 during download: accept the model terms and use a Read token with gated-repo access.

• Out of memory: add fp8-cast and --offload, switch to the conv VAE, or lower resolution and frame count.

• CUDA illegal memory access in NATTEN: the ltx-pipelines optimization docs trace this to outdated NVIDIA libraries bundled with older PyTorch. Upgrade CUDA, PyTorch, and natten to the pinned versions, or drop the extra.

Summary

LTX-2.5 has no documented official Docker image, so the reliable pattern is a CUDA base image running the documented uv sync --frozen install, with weights on a read-only mount. GPU access depends on the NVIDIA Container Toolkit, verified with nvidia-smi before anything else. The natten extra pins torch==2.13.0 for CUDA 13.2, while the conv video VAE avoids extra dependencies. ComfyUI Docker setups need mounted model folders and a port bound to localhost. Hugging Face tokens stay on the host, never in image layers.

Ready to containerize? Grab the weights from the LTX open-source model page, build the image, and run your first distilled generation. For deployment planning beyond one box, read deploying LTX on-premise.

Table of Contents: