Build a GenAI App With Java Using Spring AI and Docker Model Runner
A Spring Boot GenAI app can run entirely on local models by pointing Spring AI's OpenAI module at Docker Model Runner's OpenAI-compatible endpoint, using llama3.1 for chat and mxbai-embed-large for embeddings. A plain /chat endpoint hallucinates details about Testcontainers, such as nonexistent classes and URLs. A /rag endpoint uses QuestionAnswerAdvisor over a Qdrant vector store, with documents ingested via TokenTextSplitter, and grounds the answer in the supplied docs. An integration test built on Testcontainers and Spring AI's FactCheckingEvaluator automatically checks that answers are supported by the retrieved documents, and the Grafana LGTM stack is then wired in for observability.
Related posts
- How to Make an AI Chatbot from Scratch using Docker Model Runner
Docker mediumAdeptA 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 Gemma 3 with Docker Model Runner: Fully Local GenAI Developer Experience
Docker mediumAdeptDocker 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.
- How to Build, Run, and Package AI Models Locally with Docker Model Runner
Docker mediumAdeptDocker 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.
- Building an Easy Private AI Assistant with Goose and Docker Model Runner
Docker mediumAdeptGoose, a CLI AI assistant, can run entirely on a local model by pointing its OpenAI provider at Docker Model Runner's OpenAI-compatible endpoint. The steps are: enable Model Runner and host TCP access on port 12434 in Docker Desktop, pull ai/qwen3:30B-A3B-Q4_K_M, then set OPENAI_HOST and OPENAI_BASE_PATH (/engines/llama.cpp/v1/chat/completions) in Goose's config.yaml with the Developer extension enabled. Goose can then be scripted with `goose run -i instructions.md` and scheduled via crontab for recurring automations, with no data leaving the machine.
- AI-Powered Testing: Using Docker Model Runner with Microcks for Dynamic Mock APIs
Docker mediumAdeptMicrocks' AI Copilot can generate varied, realistic mock API responses using a local LLM served by Docker Model Runner through its OpenAI-compatible endpoint. The setup pulls a quantized Qwen3 8B model, points Microcks' application.properties at model-runner.docker.internal so containers talk to the runner directly, enables the copilot feature flag, and runs Microcks via Docker Compose. Generated samples can be added to mocked operations and exercised with curl, and declaring the model in compose.yml makes the test setup reproducible.