Skip to content

Docker Integration

Three Docker capabilities: Docker Model Runner for GPU-accelerated local inference, Ollama containers via docker-compose, and the MCP Docker Gateway for unified tool catalogs.

Docker Desktop’s built-in inference engine. CodeBuddy enables it, pulls models, and routes to it automatically.

Setup:

  1. Docker Desktop installed + running.
  2. In CodeBuddy: Docker panel → Enable Model Runner, or ask the agent to enable it.

Runs:

Terminal window
docker desktop enable model-runner --tcp=12434
docker model pull <model-name>

Models accessible at http://localhost:12434/engines/llama.cpp/v1 (OpenAI-compatible API).

Model management:

ActionCLI equivalent
List modelsdocker model ls --json
Pulldocker model pull <name>
Deletedocker model rm <name>
UseAuto-sets local.model, local.baseUrl, switches to Local provider

Port fallback: on “Use Model”, CodeBuddy tries port 12434 first (1-second timeout). If unavailable, falls back to Ollama on 11434. local.baseUrl set automatically.

Extension ships a docker-compose.yml for running Ollama in a container:

  • 32 GB memory limit
  • Optional GPU passthrough
  • Persistent volume for models
  • Port 11434 exposed

Start via “Start Ollama container” in the Docker panel:

Terminal window
docker compose -f <extension-path>/docker-compose.yml up -d

Model management:

ActionCLI equivalent
Statusdocker ps --filter name=ollama --format json
List modelsdocker exec ollama ollama list
Pull modeldocker exec ollama ollama pull <name>

Docker availability detection: CodeBuddy probes the socket directly (/var/run/docker.sock on Unix, \\.\pipe\docker_engine on Windows) to check if Docker is running. Results cached 15 s to avoid repeated spawn failures.

Unified MCP tool catalog from a single Docker-managed endpoint.

How it works:

  1. CodeBuddy detects the gateway via docker mcp --help + docker info.
  2. When docker-gateway is the only enabled MCP server, all MCP tools come from that one endpoint.
  3. Transport: stdio or SSE.

Reliability features:

FeatureBehavior
Circuit breaker3 failures → 5-minute cooldown per server
Idle shutdownDisconnects after 5 min inactivity, reconnects on-demand
macOS PATH fixupInjects /usr/local/bin:/opt/homebrew/bin etc. for CLI discovery
Graceful degradationIf Docker is unavailable, agent continues with core tools only

Webview commands (docker-* message type):

CommandPurpose
docker-enable-runnerEnable Docker Model Runner
docker-start-composeStart Ollama container
docker-check-statusCheck Docker availability
docker-check-ollama-statusCheck Ollama container status
docker-get-modelsList all local models
docker-get-local-modelGet current local model config
docker-pull-modelPull a Docker model
docker-pull-ollama-modelPull an Ollama model
docker-delete-modelDelete a model
docker-use-modelSwitch active model (with port fallback)

Docker commands routed through the terminal are strictly whitelisted. Only these arg patterns pass validation:

  • Model ops — model ls, model pull <name>, model rm <name>
  • Container ops — ps --filter name=ollama, compose up -d, exec ollama ollama list
  • MCP ops — mcp server ls, mcp gateway run
  • Setup — desktop enable model-runner --tcp=12434

Model names validated against /^[a-zA-Z0-9/:\-.]+$/ — no injection.

No Docker-specific settings — Docker integration re-uses local model settings:

SettingPurpose
local.modelModel name (auto-set on “Use Model”)
local.baseUrlEndpoint URL (auto-set with port fallback)
generativeAi.option"Local" when a Docker model is selected

See Local Models for the full local-provider setup.

  • MCP — the transport that powers the Docker Gateway
  • Local models — provider abstraction Docker plugs into