Skip to content

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

Docker 7 min read How-to mediumAdept

Run Gemma 3 with Docker Model Runner: Fully Local GenAI Developer Experience

Docker Model Runner (in Docker Desktop for macOS 4.40.0+) exposes an OpenAI-compatible API on localhost, so Gemma 3 can be pulled with `docker model pull ai/gemma3` and called through the standard OpenAI SDK by pointing baseURL at http://localhost:12434/engines/v1. A sample Comment Processing System uses it to generate synthetic user feedback, categorize sentiment, cluster comments with mxbai-embed-large embeddings, extract feature ideas as JSON and draft support replies, all with no external API calls. Per-task temperature and token limits can be tuned freely because local inference carries no per-token cost or rate limit.

Assumes: OpenAI chat completions APIDocker DesktopJavaScript/Node.js

Related posts

  • 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.

  • 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}.

  • OpenCode with Docker Model Runner for Private AI Coding

    Docker mediumAdept

    OpenCode can use locally hosted models by pointing an @ai-sdk/openai-compatible provider in opencode.json at Docker Model Runner's OpenAI-compatible endpoint (localhost:12434/v1, with TCP enabled on Docker Desktop). Prompts and code then stay on infrastructure you control, and there are no per-token costs. Coding models such as qwen3-coder and devstral-small-2 ship with 128K context, while gpt-oss defaults to 4,096 tokens. `docker model package --context-size` can repackage gpt-oss as a 128K OCI artifact that teams push to a registry to standardize and version model variants.

  • 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.

  • Run Claude Code Locally with Docker Model Runner

    Docker mediumAdept

    Claude Code can run against local models by pointing its ANTHROPIC_BASE_URL environment variable at Docker Model Runner, which exposes an Anthropic-compatible API on localhost:12434. Docker Desktop users must enable TCP access first. Because gpt-oss defaults to a 4,096-token context, the guide repackages it with `docker model package --context-size 32000` so it is usable for coding, while models like qwen3-coder and devstral-small-2 already ship with 128K. `docker model requests` shows the raw requests Claude Code sends to the model, which helps debug compatibility issues.

The quest for software engineering knowledge.

Look:
Layout: