Run OpenCode, the open-source AI coding agent, in Docker with Ollama as your LLM provider. Supports TUI, headless server, web UI, and one-shot CLI modes.
Pull the image:
docker pull joyki/opencode-ui
docker run -it --rm \
-e OLLAMA_URL=http://host.docker.internal:11434/v1 \
-e OLLAMA_MODEL=qwen3:8b \
-v "$(pwd):/home/opencode/workspace" \
joyki/opencode-ui
docker run -it --rm \
-e OPENCODE_MODE=run \
joyki/opencode-ui run "Explain this project"
docker run -d \
--name opencode \
-e OPENCODE_MODE=server \
-p 4096:4096 \
joyki/opencode-ui
# API at http://localhost:4096, docs at http://localhost:4096/doc
| Variable | Default | Description |
|---|---|---|
OPENCODE_MODE | tui | Run mode: tui, server, web, run |
OLLAMA_URL | http://host.docker.internal:11434/v1 | Ollama API base URL |
OLLAMA_MODEL | qwen3:8b | Default Ollama model |
OPENCODE_PORT | 4096 | Port for server/web mode |
OPENCODE_SERVER_PASSWORD | (empty) | Basic auth password for server/web |
OPENCODE_HOSTNAME | 0.0.0.0 | Bind address |
| Path | Purpose |
|---|---|
/home/opencode/workspace | Mount your project directory here |
/home/opencode/.config/opencode | Config, agents, MCP servers |
/home/opencode/.local/share/opencode | Sessions, cache, auth |
On macOS / Windows, host.docker.internal resolves automatically.
On Linux, add --add-host host.docker.internal:host-gateway:
docker run -it --rm \
--add-host host.docker.internal:host-gateway \
-v "$(pwd):/home/opencode/workspace" \
joyki/opencode-ui
Or run Ollama as a sibling container on the same Docker network.
| Mode | Command | Description |
|---|---|---|
tui (default) | opencode | Interactive terminal UI |
server | opencode serve | Headless HTTP server |
web | opencode web | Web UI server |
run | opencode run <prompt> | One-shot CLI command |
| Tag | Description |
|---|---|
latest | Latest stable build |
git clone <repo-url>
cd opencode-web
docker compose build
OpenCode is MIT licensed. See the OpenCode repository for details.
Content type
Image
Digest
sha256:6d0af90cb…
Size
64.4 MB
Last updated
6 months ago
docker pull joyki/opencode-ui