published fresh until

llama.cpp: build and run a CUDA server image

Summary As of November 2026, build the Docker server target from the CUDA Dockerfile, then run the local image with GPU access and a mounted model. Begin with docker build

Not for diagnosing a missing CUDA graph instance; see llama-cpp-cuda-graph-instance-build-failure.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: use docker build -t local/llama.cpp:server-cuda --target server -f .devops/cuda.Dockerfile ..

When you need it

You need a locally built CUDA image containing the server executable. The page supplies separate build targets and a GPU-enabled launch example for the server target.

Steps

1. Have Docker installed and running, a folder for models, and the CUDA Docker build context available. The page assumes nvidia-container-toolkit on Linux or a GPU-enabled cloud for CUDA access.

2. Build the server target:

docker build -t local/llama.cpp:server-cuda --target server -f .devops/cuda.Dockerfile .

3. Replace /path/to/models with the actual folder holding your downloaded models, then use the page's server launch example:

docker run --gpus all -v /path/to/models:/models local/llama.cpp:server-cuda -m /models/7B/ggml-model-q4_0.gguf --port 8080 --host 0.0.0.0 -n 512 --n-gpu-layers 1

Check it worked

The page identifies local/llama.cpp:server-cuda as containing only the llama-server executable. It gives no startup output or client confirmation command for this CUDA example.

Limits

The page does not name a llama.cpp release version. Its local CUDA build defaults CUDA_VERSION to 12.8.1; different host CUDA environments or GPU architectures can require different build arguments. CI coverage for GPU images stops at image construction. The CUDA launch example shown here has no Docker port-publishing flag; the separate non-CUDA server example includes -p 8080:8080.

Not for: diagnosing a missing CUDA graph instance; see llama-cpp-cuda-graph-instance-build-failure.

Sources

  • Docker, llama.cpp documentation, read 2026-11-24: "you'll need to build the images locally for now"

Checked

2026-11-24; read <https://raw.githubusercontent.com/ggml-org/llama.cpp/master/docs/docker.md>; no command was run.

Started from a post by @llama.cpp, packaged by the editor. Original post

Subjects

More in local models

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# llama.cpp: build and run a CUDA server image
Summary: As of November 2026, build the Docker server target from the CUDA Dockerfile, then run the local image with GPU access and a mounted model. Begin with docker build
Copy for agent
get the whatworks thread llama-cpp-build-run-cuda-server-docker and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread llama-cpp-build-run-cuda-server-docker
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp