---
title: "How to Make an AI Chatbot from Scratch using Docker Model Runner"
description: "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."
url: "https://swe.quest/articles/how-to-make-an-ai-chatbot-from-scratch-using-docker-model-runner-48eab58e2814218f"
canonical: "https://www.docker.com/blog/how-to-make-ai-chatbot-from-scratch/"
source: "Docker"
published: "2025-06-03"
difficulty: "medium"
kind: "How-to"
reading_minutes: 17
tags: ["inference","observability","llms","go","containers"]
---

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

A post on [Docker](https://swe.quest/sources/docker.md), published 2025-06-03, 17 min read, How-to. Original: [https://www.docker.com/blog/how-to-make-ai-chatbot-from-scratch/](https://www.docker.com/blog/how-to-make-ai-chatbot-from-scratch/)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [Observability](https://swe.quest/tags/observability.md) (Reliability & operations)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Go](https://swe.quest/tags/go.md) (Languages)
- [Containers](https://swe.quest/tags/containers.md) (Infrastructure)

## Prerequisites

- Docker Compose ([easy posts on Containers](https://swe.quest/tags/containers.md?difficulty=easy))
- Go basics ([easy posts on Go](https://swe.quest/tags/go.md?difficulty=easy))
- React and TypeScript ([easy posts on React](https://swe.quest/tags/react.md?difficulty=easy))
- Prometheus metrics ([easy posts on Observability](https://swe.quest/tags/observability.md?difficulty=easy))

## Keywords

Docker Model Runner, llama.cpp, Prometheus, Grafana, Jaeger, Llama 3.2, OpenAI API, Server-Sent Events

## Related posts

- [Run LLMs Locally with Docker: A Quickstart Guide to Model Runner](https://swe.quest/articles/run-llms-locally-with-docker-a-quickstart-guide-to-model-runner-ccfbbb71db5d1485.md): Docker · 2025-04-04 · Medium · 5 min read · Inference & serving, LLMs, Containers, Developer tools
  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.
- [How to Build, Run, and Package AI Models Locally with Docker Model Runner](https://swe.quest/articles/how-to-build-run-and-package-ai-models-locally-with-docker-model-runner-acbc6d65548e5373.md): Docker · 2025-06-12 · Medium · 6 min read · Inference & serving, LLMs, Containers, Developer tools
  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.
- [Run Gemma 3 with Docker Model Runner: Fully Local GenAI Developer Experience](https://swe.quest/articles/run-gemma-3-with-docker-model-runner-fully-local-genai-developer-experience-c005339b3915484f.md): Docker · 2025-04-09 · Medium · 7 min read · LLMs, Inference & serving, Containers, JavaScript
  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.
- [Build a GenAI App With Java Using Spring AI and Docker Model Runner](https://swe.quest/articles/build-a-genai-app-with-java-using-spring-ai-and-docker-model-runner-2e0c221c42a705e5.md): Docker · 2025-07-11 · Medium · 11 min read · RAG & retrieval, Java & JVM, Testing, LLMs, Observability
  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.
- [Building AI agents made easy with Goose and Docker](https://swe.quest/articles/building-ai-agents-made-easy-with-goose-and-docker-05962e3d4c772056.md): Docker · 2025-08-12 · Medium · 7 min read · AI agents, Containers, LLMs, Inference & serving
  A local, containerized AI agent can be assembled from Goose as the agent, Docker Model Runner serving a Qwen3 30B GGUF model through an OpenAI-compatible endpoint, and Docker MCP Gateway exposing a YouTube transcript tool over SSE, all wired together with Docker Compose.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
