feat: make llama.cpp a deferred backend on macOS/Windows#737
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the llama.cpp backend to support deferred installation on macOS and Windows, which is a great improvement. The changes are well-structured, introducing a unified installDir and a BackendUpdater interface for managing binary updates. My main concern is with error handling in main.go where a failure to determine the llama.cpp server path is logged but not treated as a fatal error, which could lead to issues later on. I've added a critical comment with a suggestion to address this.
On macOS/Windows the llama.cpp server binary is now downloaded on demand
into a single, writable per-user install directory
(~/.docker/model-runner/llama.cpp/bin) instead of relying on a binary
vendored by Docker Desktop. This removes the vendored/updated storage
split and the requirement for a bundled com.docker.llama-server.digest.
- Collapse vendoredServerStoragePath/updatedServerStoragePath into a
single installDir; default to ~/.docker/model-runner/llama.cpp/bin when
no path is configured.
- Add llamacpp.NeedsDeferredInstall() (true on macOS/Windows) and mark the
backend Deferred in the routing defs so it installs on first use instead
of blocking startup.
- Reuse main's mirror-aware dockerhub download path and the existing
docker/docker-model-backend-llamacpp {version}-{variant} image tags; the
download no longer hard-fails when there is no Desktop-bundled binary.
- Linux keeps bundling the binary in the container image (not deferred);
ensureLatestLlamaCpp remains a no-op that reports the bundled binary.
- LlamaServerPath() no longer defaults to the read-only Docker Desktop
bundle path; it returns the env override or empty.
- Add a `docker model install-runner --backend llama.cpp` trigger for the
deferred install, mirroring the vllm-metal path.
Signed-off-by: Dorin Geman <dorin.geman@docker.com>
a2db150 to
7469d77
Compare
By default the deferred macOS/Windows download now fetches a specific
llama.cpp version pinned to this model-runner build instead of the mutable
`latest` tag, so a given release always installs the version it was tested
against and doesn't silently move when Docker Hub publishes a new build.
- Add a pinnedServerVersion constant (a docker-model-backend-llamacpp tag)
used as the default DesiredServerVersion; bump it together with the Linux
bundle (Dockerfile LLAMA_SERVER_VERSION) when llama.cpp is upgraded.
- Allow opting into another version on demand, via LLAMA_SERVER_VERSION or a
new `--llama-server-version` flag on install-runner/reinstall-runner
(e.g. `--llama-server-version latest`). The flag threads through the
InstallBackend API and a new inference.BackendVersionSelector interface,
keeping the scheduler decoupled from the concrete backend.
- Skip the registry digest round-trip when a pinned (immutable) version is
already installed, recording {tag,digest} in .llamacpp_version. This makes
startup work offline for pinned versions and removes the per-launch Docker
Hub call; only `latest` is always re-resolved. Also report the on-disk
binary as running when updates are disabled.
Signed-off-by: Dorin Geman <dorin.geman@docker.com>
f8b8e76 to
4e6fb00
Compare
ilopezluna
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.