Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Docker 16 min read Case study mediumAdept

Behind the scenes: How we designed Docker Model Runner and what’s next

Docker Model Runner runs AI models locally and exposes them to both containers and host processes through Docker-style /models endpoints and OpenAI-compatible /engines/{engine}/v1 endpoints. llama.cpp is the first backend, but the API path leaves room for others like vLLM and MLX. On Docker Desktop, inference runs on the host outside the VM to get reliable GPU acceleration, with API calls proxied from the VM; on Docker CE it runs in containers with direct hardware access. A scheduler/loader swaps engine-model process pairs in and out of memory and holds requests until RAM/VRAM frees up rather than returning 503s. Model tensors are kept in a separate store so the engine can mmap them.

Related posts

  • Run LLMs Locally with Docker: A Quickstart Guide to Model Runner

    Docker mediumAdept

    Docker Model Runner, in beta with Docker Desktop 4.40 on Apple silicon, pulls LLMs packaged as OCI artifacts and serves them through an OpenAI-compatible API backed by llama.cpp. Unlike `docker container run`, `docker model run` starts no container. The inference engine runs as a native host process for GPU acceleration, loads models on demand, and unloads them after 5 minutes of inactivity. Containers reach it at model-runner.docker.internal, and host processes can use an optional TCP port (12434), so any OpenAI client such as LangChain4j can point at it by setting a base URL and a model tag of the form {model}:{parameters}-{quantization}.

  • How to Build, Run, and Package AI Models Locally with Docker Model Runner

    Docker mediumAdept

    Docker Model Runner, enabled as a beta feature in Docker Desktop 4.40+, pulls GGUF-format LLMs from Docker Hub or Hugging Face and runs them locally via the `docker model` CLI or an OpenAI-compatible HTTP endpoint on localhost. The guide walks through enabling the feature, pulling, tagging and pushing models to a local registry, one-shot and interactive prompts, curl calls to the chat completions API, and packaging your own .gguf file with a license as an OCI artifact. Constraints noted: only GGUF is supported, one model is loaded at a time, and models unload after 5 minutes idle. Compose v2.35+ can declare models as services and inject connection URLs into dependent containers.

  • Docker Model Runner on the new NVIDIA DGX Spark: a new paradigm for developing AI locally

    Docker mediumAdept

    Docker Model Runner now supports NVIDIA DGX Spark, a compact Grace Blackwell GB10 workstation with 128GB of unified memory, for running large models locally. Setup means installing the docker-model-plugin on DGX OS's preinstalled Docker Engine and pulling a model such as ai/qwen3-coder, which is exposed through an OpenAI-compatible API on port 12434 with GPUs passed through nvidia-container-runtime. SSH port forwarding lets a laptop use the Spark as a remote model host and view its GPU dashboard, shown with a sample OpenCode configuration that points the coding agent at the local Qwen3-Coder endpoint.

  • Why Docker Chose OCI Artifacts for AI Model Packaging

    Docker mediumAdept

    Docker Model Runner packages LLMs as a custom OCI artifact type rather than as container images, so models can be pushed, pulled and access-controlled through existing OCI registries like Docker Hub. The format defines its own media types: a model config JSON exposing format, quantization, parameter count and size, plus GGUF and license layers. Model layers are always uncompressed single raw files, because high-entropy weights barely compress, and storing them this way lets inference engines memory-map them directly while identical files deduplicate into reusable blobs. Keeping models separate from inference engines lets users pick an engine build optimized for their hardware, and planned additions include runtime config, LoRA adapters, multimodal projectors and model index files.

  • How to Make an AI Chatbot from Scratch using Docker Model Runner

    Docker mediumAdept

    A local GenAI chatbot built on Docker Model Runner, which runs llama.cpp models natively on the host and exposes an OpenAI-compatible API to containers. A Go backend uses the OpenAI client to stream tokens over SSE to a React/TypeScript UI. The backend also acts as a metrics bridge, exporting llama.cpp-specific Prometheus gauges such as tokens per second, context size, prompt evaluation time and memory per token, alongside Grafana dashboards and Jaeger tracing. The walkthrough covers pulling Llama 3.2 1B, starting the stack with docker compose, wiring Grafana to Prometheus, and the key code paths.

The quest for software engineering knowledge.

Look:
Layout: