Run OpenCode with local Ollama models in a sandbox

On a 48GB MacBook: Docker sbx sandbox + OpenCode + Ollama with Qwen 3.8 27B for multi-hour runs.

by tensorsandtokens11 Sep 2026

Prompt for your agent

Goal: Set up local-model coding in a sandbox on my Mac.
Setup: agents used in source: OpenCode; tools/MCPs stated: Ollama, Docker sbx.
Steps:
1. Install Docker Sandbox: brew trust docker/tap && brew install docker/tap/sbx.
2. Install OpenCode: brew install anomalyco/tap/opencode. Install the Ollama app.
3. Pull a workhorse model (e.g. ollama pull qwen3.8:27b-mxfp8, ~32GB) for long runs.
4. Run OpenCode inside the sandbox so hallucinated commands can’t touch your machine.
Rules: ask me before anything irreversible (sending, posting, paying, deleting); don’t invent data, results or tools I haven’t given you; tell me what you couldn’t verify.
Based on: tensorsandtokens — https://tensorsandtokens.com/posts/opencode-ollama/

Steps are from the source. Includes a “Based on” credit line.

I tried this

Tell the next builder. One anonymous answer each; click again to undo.

Agents, models and tools only what the source states

Agents
OpenCode
Models
Qwen 3.8 27B Gemma 4
Tools
  • Ollama
  • Docker sbx

Sources & credit