Docker is the way to run llama.cpp on a machine you do not want to build on: the container carries the binaries and the backends, and you only supply the model. The server even has a --docker-repo flag for pulling a model from a Docker Hub repository.
Run the container and serve the model
Follow the project’s Docker documentation to run the container — the README points to it as one of the install routes. To load a model from Docker Hub instead of a local file, start the server inside the container with -dr, --docker-repo [<repo>/]<model>[:quant], where the repo defaults to ai/ and the quant defaults to :latest; for example -dr gemma3 pulls the gemma3 model from the Docker Hub repository.
llama-server -dr gemma3
# repo defaults to ai/, quant defaults to :latest
# or run the container per the project's Docker documentation
A container still needs the GPU passed through to use it: without the GPU device flags, the container runs on CPU and is slow. Check the container’s log for which backend it picked before judging its speed — a CPU-only container looks like a broken GPU build.
Try it: four checks
| Check | What you should see | If you do not see it |
|---|---|---|
| Container runs | The container starts without an error | Follow the Docker documentation |
| Model loads | The server loads the model from the repo | Check the -dr value spelling |
| GPU passed through | The log shows the GPU backend | Without it, the container runs on CPU |
| Server answers | The server answers on its port | Check the port mapping |
Expected result. We checked the llama.cpp README, which lists running with Docker as an install route, and the server README, which defines –docker-repo with the ai/ default and :latest quant default. We did not run a container on this machine.
Limits
This guide covers the Docker route only. GPU passthrough and the exact container command depend on your Docker setup. We did not test any container ourselves.
